Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with freeing memory in STL

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am using a std::list of pointers, and I add things to this list with push_back() and delete from it with the member function remove(). The problem is, sometimes when I call remove(), it tries to free the list node that holds the value I want to remove and promptly brings up the 'assertion failed' dialog in free_dbg or wherever. Which, I believe, usually means I'm trying to delete an invalid pointer, such as one that is already deleted.

Checking the call stack shows that the pointer in question -looks- to be ok. Now I can't see how anything I've done wrong would cause the stl to accidentally delete one of its own nodes twice or whatever, so has anybody got any idea why it is having trouble deleting list nodes? Or perhaps ideas for finding out what the real problem is?

I'm running VC6, SP4, with the downloaded fixes from the Dinkumware STL page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top