C
CMOS
consider the below code. it just creates a map and inserts 51000000
elements. when i check the memory usage , it shows an increase of
memory after the loop. the increase is around 2mb. i used "ps aux"
command and use the VSZ value.
why is this happening? i dont see any memory leaks as nothing is
created in heap/free store.
is this some kind of a memory fragmentation issue?
// memory ckeck 1 goes here
{
std::map<std::string, int> mm;
for(int i=0; i<51000000; ++i)
{
std::string s;
s = i;
mm = i;
}
}
// memory ckeck 2 goes here, and there is an increase in memory
elements. when i check the memory usage , it shows an increase of
memory after the loop. the increase is around 2mb. i used "ps aux"
command and use the VSZ value.
why is this happening? i dont see any memory leaks as nothing is
created in heap/free store.
is this some kind of a memory fragmentation issue?
// memory ckeck 1 goes here
{
std::map<std::string, int> mm;
for(int i=0; i<51000000; ++i)
{
std::string s;
s = i;
mm
}
}
// memory ckeck 2 goes here, and there is an increase in memory