Posted by Leon Gunden on April 17, 2001 at 21:33:50:
In Reply to: Re: About Memory Leaks posted by Aaron Faust on April 17, 2001 at 18:58:44:
: I assume that you are using the STL list. Why not just call list.remove(Creature* X). This way, the list takes care of searching and deleting for you - all dynamic memory is deallocated via the list implementation.
I am pretty sure the STL container will not deallocate the dynamic memory for you. As far as it is concerned the only thing it is responsible for is the pointer it is storing, not whats on the other end of the pointer. Not sure about this but you might want to instrument (with cout statement) your destructor and do a list.remove(Creature* x), to see if the creature destructor is actually firing...
Post a Followup