LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 674|回复: 0

求助 valgrind使用问题(第一次使用)

[复制链接]
发表于 2005-10-1 21:22:41 | 显示全部楼层 |阅读模式
测试程序是:
//----------------------------------
#include <stdio.h>
#include <stdlib.h>
int main()
{
        int *p, i, a;
        p = malloc(10*sizeof(int));
        p[10] = 1;
        p[11] = 1;
        a = p[11];
        free(p);
        return 0;
}
//---------------------------------------
然后
# gcc -g test.c -o test
# valgrind --tool=memcheck test

出来的信息是:
==5581== Memcheck, a memory error detector for x86-linux.
==5581== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==5581== Using valgrind-2.4.1, a program supervision framework for x86-linux.
==5581== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==5581== For more details, rerun with: -v
==5581==
==5581==
==5581== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 1)
==5581== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5581== malloc/free: 32 allocs, 32 frees, 2033 bytes allocated.
==5581== For counts of detected errors, rerun with: -v
==5581== No malloc'd blocks -- no leaks are possible.


而且不管我用什么程序下去测试结果都是这样。。。


我的机子是c4 2.0 + fedora core4
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表