I have a Win XP 32 bit machine . I am using Visual C++ language to test this scenario . I create a vector like vector<__int64> v . I take a note of virtual memory , say its 400 KB now. Then I push around 5 million integers in it . Now I note the virtual memory , its increased to say around 900 KB . Now I call a erase or clear on the vector . Now I check the virtual memory its 600 KB .
I try the same scenario with vector of int v . This time I get the exact amount of memory before populating the vector and after flushing the vector .
Why is there a difference between memory ?
From comments: SmartHeap is used.