I'm working on a fairly large c++ project. Now I'm stopped dead in my tracks trying to dump memory from std::vector and std::map types. I don't understand why this appears to be so impossible, but I can't find a single thing that has worked.
For instance I have a vector like: (all of my vectors contain nearly 1,000 elements) so memory usage is quite significant
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
name_vec.vector(); this instanly appears to do what I did above, vector is empty and allocated size is 0. No memory change.
Maps turn out to be unusable after you call map() unless its a pointer and you reallocate it using new. The map is the largest memory source of my program, calling map() doesn't do anything to memory usage.
I've also tried iterating through the map and deleting the contents of first and second by hand. Still no change.
This problem appeared when I was testing time and mem usage vs different compilers of my program and I realized that through every iteration and re-reading the files that the memory wasn't dumping at all. And my program would waste 20+mb of memory after some iterations. This is baffling me, if anyone could offer some insight...