
21 Apr
2009
21 Apr
'09
2:47 p.m.
AFAICS, you can have an implementation of delete where "delete p" simply calls the destructor of the object pointed to by p and then passes p to an internal garbage collector that will reclaim the memory in due time. This way you have determinstic resource liberation *and* GC speed.
If you do that, what is the point of keeping the memory occupied by 'p' around? the object will be destroyed anyway and therefore it will not be of any use. By using pool allocators, allocation/deallocation can become as fast as when using a garbage collector.