I have a memory-intensive real-time algorithm that runs continously.
The memory it uses is malloced and freed (actually 'new'ed and
'delete'd but you get the idea).
Now, after maybe several hours, I find that the "SIZE" of the program
as given by the UNIX utility "top" has increased. The memory being
actually used by the system ("RES" in top) remains within the normal
bounds. SIZE continues to increase, with no set pattern, while "RES"
remains within range.
I have run the program under purify but even when the SIZE has increased,
there are absolutely no leaks. Not even 4 bytes!
Questions:
1) Why could this (SIZE increases, RES okay) happen? How can we fix it?
2) Hypothesis: maybe the memory is getting fragmented and so, the program
keeps continously adding to its SIZE in order to get the required memory.
How do I _really return_ allocated memory to the system instead of free-ing
but tagging it for future use by the program?
thanks for any suggestions!