On 14 feb 2007, at 17:14, Jason P Sage wrote:

If I allocate a large number of ansistrings of random lengths, change
lengths, and then set them all to empty like this: MyAnsi:='' Does the heap release all that memory or does it hang on to it to "reuse" the various
"chunks" that are not in use when appropriate?

It may hang around for a while. Whether or not it does depends on many different factors, including the size of the block (blocks with similar small sizes are allocated from pools, and a pool is only released back to the OS if all blocks of a pool have been freed -- although one empty pool is always kept in order to avoid a border condition where allocating/freeing a single block causes constant allocating and freeing of a block from/to the OS).

Note: I'm aware of heap trace but the nature architecture my project just does not agree with heap trace. Certain things I do purposely it mistakes as an error and these same "constructs" run leak proof in other applications.

Things which are flagged as errors by heaptrace are not leaks, but writing past the boundaries of allocated memory blocks. This may also lead to memory leaks due to corruption of the memory manager's internal data structures.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to