- 论坛徽章:
- 0
|
hash.tar
(20 KB, 下载次数: 83)
写的一个hash链表,申请了1000000个桶里面放500000条数据,然后查询,删除,最后释放链表 hash_close。
可是在本进程退出之前,明明已经释放了所有的申请空间,但是本进程还是占了40M内存(用free -m看到的),
但是用valgrind检测:
#valgrind --tool=memcheck --leak-check=full -v ./hash_test
结果是:
==8627== HEAP SUMMARY:
==8627== in use at exit: 0 bytes in 0 blocks
==8627== total heap usage: 1,500,005 allocs, 1,500,005 frees, 58,777,857 bytes allocated
==8627==
==8627== All heap blocks were freed -- no leaks are possible
==8627==
==8627== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 3)
--8627--
--8627-- used_suppression: 3 dl-hack3-cond-1
==8627==
==8627== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 3)
提示没有内存泄露。
这是怎么回事啊?
已经附上源码。 |
|