How to correctly deallocate or delete a c++ vector?

前端 未结 6 1645
灰色年华
灰色年华 2021-01-25 11:00

I have a weird problem with vector in C++..

I created a vector and inserted 10000 integer values into it and have checked the memory utilization. It is 600 kb. But after

6条回答
  •  甜味超标
    2021-01-25 11:33

    Presumably you checked memory with some system utility. Even if the vector space is freed on the heap that does not mean the heap space itself is going to be returned to the OS and reflected in the values shown in the system utility.

提交回复
热议问题