【发布时间】:2013-02-10 20:22:42
【问题描述】:
这个最小的程序:
int main()
{
return 0;
}
使用 gcc 编译并使用 valgrind 运行时效果很好。
当使用
编译为 D 程序时dmd test_new.d && valgrind ./test_new
我明白了:
HEAP SUMMARY:
in use at exit: 360 bytes in 4 blocks
total heap usage: 22 allocs, 18 frees, 52,024 bytes allocated
LEAK SUMMARY:
definitely lost: 288 bytes in 3 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 72 bytes in 1 blocks
suppressed: 0 bytes in 0 blocks
使用 gdc:
gdc -o test_new test_new.d && valgrind ./test_new
我明白了
HEAP SUMMARY:
in use at exit: 568 bytes in 4 blocks
total heap usage: 23 allocs, 19 frees, 52,664 bytes allocated
LEAK SUMMARY:
definitely lost: 496 bytes in 3 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 72 bytes in 1 blocks
suppressed: 0 bytes in 0 blocks
这里有什么问题?
【问题讨论】:
标签: memory-leaks valgrind d