赞
踩
一.http://blog.sina.com.cn/s/blog_4673e6030101haxg.html
最近使用ACE的Message_Block时发现,程序运行一段时间之后内存越吃越多,即便没有请求,内存也不会下降。
二.http://my.huhoo.net/archives/2010/05/malloptmallocnew.html
int32_t i;
std::queue<char *> qTest;
for (i = 0; i < 100000; i ++) {
char *p = new char[100];
qTest.push(p);
char *p1 = qTest.front();
delete[] p1;
qTest.pop();
}
int32_t i;而发现通过delete[]后,内存并没有减少,即使重复上面的单元,内存只会增加,不会减少,用valgrind的memcheck工具查看,也无内存泄漏。
std::queue<char *> qTest;
for (i = 0; i < 100000; i ++) {
char *p = new char[100];
qTest.push(p);
//char *p1 = qTest.front();
//delete[] p1;
//qTest.pop();
}
while( !qTest.empty() ) {
char *p1 = qTest.front();
delete[] p1;
qTest.pop();
}
int mallopt (int PARAM, int VALUE)When calling `mallopt', the PARAM argument specifies the parameter
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。