[fpc-devel] Ansistring and General Memory Management - Questions

Jason P Sage jasonpsage at jegas.org
Wed Feb 14 17:14:41 CET 2007

I've read about the heap manager, I know that ansistring's behave well in
multi-threaded apps - if you do your house keeping, but I'm trying to track
a memory leak - and I have a question. 

I appreciate any and all responses, and I'm basically looking for validation
or to be corrected.

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?

The reason I ask is I appear to have a memory leak - but it might be the
heap manager "saving the memory" for use later versus reallocating the

I am quite aware leaks happen - and they are usually my fault when I
encounter them - but it might be I'm chasing my tail because the heap
manager is doing something innovative and everything is fine, and there is
not a leak. 

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. 

Thank you in Advance,
Jason P Sage

More information about the fpc-devel mailing list