void parsefile (TDM & my_map, string in_file); // parse input file and put it in the data map
float CheckMemUsage (void); // check memory usage by extracting /proc/self/stat info
int main (int argc, char *argv[]) {
TDM my_map;
string infile = "xxx";
INFO: Memory usage before parse file: 13.46M.
INFO: Memory usage after parse file: 203.53M.
INFO: Memory usage after delete map: 132.59M.
In the function "parsefile", I only use string, vector, pair, map stuffs, without new any memory. So after this program, I assume that only my_map is in memory. After deleting my map, the memory usage should return to before parsing file status (13.46M). But it still reports a 132.59M. What is this 132M for? Is there sth wrong in my program?
It's more likely that the pages are not being released back to the OS at all when they were allocated as a result of calling new (and not by new[]), but kept around by the application for future use.
I am observing the same behavior, not only with maps.