www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/17/12:45:46

Date: Tue, 17 May 94 12:49:12 EST
From: acmq AT alpha DOT coe DOT ufrj DOT br (Antonio Carlos Moreirao de Queiroz)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: memory allocation details

Hi,

I am seeing some questions about memory allocations in the list, and am also
having problems with it. I deleted most of the recent mail about the subject,
so I probably will be asking questions already answered.

* The "_go_dpmi-remaining...memory" functions return values that never 
  decrease, and so are not equivalent to the usual "coreleft" function.
  And all are not  very useful because they ignore vacant spaces inside the
  heap. Am I right?

* Is there some function equivalent to the Borland C "heapwalk", that returns
  informations about the state of each allocation space in the heap?

* What exactly does "malloc"? What is the exact amount of memory necessary for
  an allocation? How is the structure of the heap? 

* I am getting garbage when trying to use "memmove" to move the contents of two
  identical structures allocated with "malloc", one to the other. 
  The contents of other allocated structures are being corrupted by the
  operation. The sizes used in "malloc" and "memmove" are the same, and both
  structures are filled with data, and not only allocated, when the move is
  done. Some suggestion?

I have a program that does a complex memory manipulation using many "malloc"s
and "free"s,  and must be certain that the operation can be completed before
it is started. Knowing exactly how many bytes will be used in an allocation, 
the program is able to test the condition (at least in Borland C).
I know that this is not a good programming practice in C...
The memory movement avoids a lot of heap fragmentation, but can be eliminated.

Thanks for reading, and to anyone that can give me answers,

Antonio Carlos M. de Queiroz

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019