In message 200105300203.EAA27083@goedel.fjf.gnu.de Frank Heckenbach writes:
David James wrote: [snip]
I still see some unfreed memory.
These are from calls at lines 116 and 214 of rts/heap.pas.
Sizes 0xd, 0x21, 0x5c, and the majority for 0xc08.
Those called from line 116 (which should all be $c08 on 32 bit machines) are the internal structures used to keep track of the pointers (i.e., if you don't use HeapMon and don't call `Mark' anywhere in your code, they should disappear). I see that something can be optimized to keep their number smaller, and I'll do this now, but since you probably don't need HeapMon except for debugging, that shouldn't be too important to you, I suppose.
About the other ones: The RTS uses a few of them to store internal values. These intentionally don't show up in HeapMon, and their number should be fixed (i.e., not growing when the program runs longer). Besides them and the ones you allocated, there should be no pointers allocated from line 214 (which is the main entry point for allocation) left.
In particular, without HeapMon the program should not lose more and more memory now, I hope (and soon also with HeapMon).
Thank you for the details. I've now tried my test after removing HeapMon from the program, and the memory leaks seem to have away. Thank you very much.