*** glibc detected *** double free or corruption - ERROR
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Telling the program exactly how to deep copy objects, if you don't do this then it is only the pointers that get copied and this leads to big problems. (Also remember to make sure that your destructor properly deletes all pointers.
Hope that helps someone.
Last edited by bandwidthjunkie; 03-19-2007 at 09:31 AM.
hmm, maybe you didn't type your program in right, because that shouldn't compile, you're trying to push a MyClass pointer (MyClass*) into a vector of MyClass objects.
You are right I forgot the * in the code above (I have edited it now), it was just an example and what I had written wouldn't have compiled. My situation was that the code compiled, but I got this "double free or corruption error" - I noticed that there were a few long meandering and not very useful threads on various sites about this, but none of them seemed to give an answer to the problem so I thought I would post one here so it might be easy to find from a google search.