[Gc] gc and tracking memory usage
Thu, 16 Jan 2003 00:55:08 -0600 (CST)
I am currently porting a simulator from a custom memory allocator to the
garbage collector. One of the features of the old allocator was the
concept of memory ids. You could pass an id to new and delete, and it
would keep track of how much memory you had allocated and freed under
that id for debugging purposes.
I'd like to keep that accounting aspect of the old allocator, while using
gc under the hood. The only way I can see to do this is to add
finalization code to update the statistics. I've read the material on the
website about finalization with cyclic structures, and I'm wondering if
there is any way to maintain the amount freed correctly. Thank you in
"The universe is full of magical
things, patiently waiting for our
wits to grow sharper."
- Eden Phillpots