- 論壇徽章:
- 0
|
hash.tar
(20 KB, 下載次數(shù): 83)
2011-04-27 17:12 上傳
點擊文件名下載附件
寫的一個hash鏈表,申請了1000000個桶里面放500000條數(shù)據(jù),然后查詢,刪除,最后釋放鏈表 hash_close。
可是在本進程退出之前,明明已經(jīng)釋放了所有的申請空間,但是本進程還是占了40M內(nèi)存(用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)
提示沒有內(nèi)存泄露。
這是怎么回事。
已經(jīng)附上源碼。 |
|