在Android shell上:
/data/local/valgrind/enter code herebin/valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=/sdcard/valgrind.log /data/local/Test
=============================================== =========================
valgrind.log - HEAP SUMMARY:
== 21314 == HEAP SUMMARY:
== 21314 ==在退出时使用:6块中的2,098,270字节
== 21314 ==总堆使用量:6个分配,0个释放,分配2,098,270个字节
== 21314 ==
== 21314 == 1个区块中的4个字节肯定会在丢失记录1中丢失6个
== 21314 ==在0x482BAEC:malloc(vg_replace_malloc.c:291)
== 21314 == by 0x864B:??? (在/ data / local / Test中)
== 21314 ==
== 21314 == 1个街区中的10个字节肯定会在6个损失记录中丢失
== 21314 ==在0x482BAEC:malloc(vg_replace_malloc.c:291)
== 21314 == by 0x863B:??? (在/ data / local / Test中)
== 21314 ==
== 21314 = = 1个块中的80个字节肯定会丢失在丢失记录3中的6个
== 21314 == at 0x482C2E4:operator new [](unsigned int)(vg_replace_malloc.c:378)
== 21314 == by 0x85DF:??? (在/ data / local / Test中)
== 21314 ==
== 21314 = = 1个块中的1,024个字节仍然可以在丢失记录4中获得6
== 21314 ==在0x482BAEC:malloc(vg_replace_malloc.c:291)
== 21314 == by 0x4852DB3:__smakebuf(在/system/lib/libc.so中)
== 21314 ==
1个块中的== 21314 == 1,048,576个字节可能在6个丢失记录中丢失
== 21314 ==在0x482BAEC:malloc(vg_replace_malloc.c:291)
== 21314 == by 0x86C3:??? (在/ data / local / Test中)
== 21314 ==
== 21314 == 1个街区中的1,048,576个字节肯定会丢失6个丢失记录
== 21314 ==在0x482BAEC:malloc(vg_replace_malloc.c:291)
== 21314 == by 0x869F:??? (在/ data / local / Test中)
== 21314 ==
== 21314 ==泄漏摘要:
== 21314 ==绝对丢失:4个块中的1,048,670个字节
== 21314 ==间接丢失:0个块中的0个字节
== 21314 ==可能丢失:1个块中的1,048,576个字节
== 21314 ==仍然可以访问:1个块中的1,024个字节
== 21314 ==抑制:0个块中的0个字节
== 21314 ==
== 21314 ==对于检测到的和抑制的错误计数,请重新运行:-v
== 21314 ==错误摘要:来自18个上下文的137个错误(被抑制:0从0开始)
Android.mk:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := Test LOCAL_SRC_FILES := helloworld.cpp APP_CPPFLAGS += -O0 include $(BUILD_EXECUTABLE)**
在Linux上我运行ndk-build NDK_DEBUG=1
所以这个测试是可调试的,为什么valgrind日志不显示行号?