Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard
Alvaro wrote:Things would be much more clear if you could post a tiny program that shows the problem. Make it as small as possible, removing anything that is not related to the problem. My guess is that you are accidentally making shallow copies of the object, and then several destructors will delete[] the pointer. In other words: You haven't followed the "rule of three": http://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming).
This is a tricky part of C++ programming, but it's worth making the effort to understand it well. Then you can use STL containers most of the time and occasionally shared_ptr, and for the most part you won't see these problems again.
deca5423 wrote:name_vec.clear(); - you would assumed since you want to clear it, you don't care about the data, apparently this isn't the case... then I try after
name_vec.reserve( 0 ); - now it's size is 0. yay! but memory usage hasn't dropped
Users browsing this forum: No registered users and 2 guests