mtrace跟踪内存泄漏
摘要:
mtrace是用来跟踪内存泄漏的功能开关,muntrace是用来关闭地它的跟功能。在使用mtrace时要在环境变量中添加宏MALLOC_TRACE,宏的值为生成的内存跟踪文件名。#include <stdio.h>#include <stdlib.h>#include <mcheck.h>int main(){ mtrace(); char *ptr = NULL; for(int i =0;i<2;i++) { int * p = (int*) malloc(sizeof(int)); p[1] = 1; } munt... 阅读全文
posted @ 2013-04-22 22:41 <为爱走天涯> 阅读(170) 评论(0) 推荐(0)
浙公网安备 33010602011771号