小编Car*_*thi的帖子

std :: queue内存消耗会导致内存泄漏 - C++?

即使在我弹出qInt队列中的所有元素之后,以下代码也没有释放3000个元素所消耗的内存.是什么原因 ?

std::queue<int> qInt; //Step01: Check the running memory

for (int i=0;i<3000;i++)
{       
    qInt.push(i);
}
//Step02: Check the running memory it should have been increased    

while(!qInt.empty())
{
    qInt.pop();
}
//Step03: Check the running memory expecting Step01 memory but it is still the same of Step02
Run Code Online (Sandbox Code Playgroud)

c++ memory queue stl visual-c++

4
推荐指数
1
解决办法
2407
查看次数

标签 统计

c++ ×1

memory ×1

queue ×1

stl ×1

visual-c++ ×1