On Mon, Apr 20, 2009 at 6:20 PM, Jos Timanta Tarigan <[email protected]> wrote: > so technically im gonna im gonna deal with lots and lots of objects, > dynamically added and removed from the vector. so i think we agree on vector > of pointer :) > but i also notice the not deleted object matter. so if i remove the object > from the vector, i have to call destructor for this object? what happened if > i just let it go (not calling the destructor)? will the memory remain > occupied?
If you don't do anything then of course the objects will still occupy memory. You need to call delete on the objects in question to let them go. A simple rule of thumb is that there should be one delete call for each new call in your program. -- Tamas Marki
