From: Vignesh <mv...@ya...> - 2014-05-24 11:21:28
|
Hi, I am having troubles finding memory leaks and array over shoots with valgrind on android. I have a binary that intentionally leaks few bytes. When I run the binary in valgrind environment on an android phone (adb shell), I see valgrind reporting no errors. Please help me understand if I am missing any. I compiled valgrind that came with android release under external directory (git clone https://android.googlesource.com/platform/external/valgrind) My program: -------------- #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char** argv) { int i = 0; char *leak = (char *) malloc(10); char *noleak = (char *)malloc(20); free(noleak); noleak = NULL; return 0; } Name of the executable: sample Output from valgrind: ------------------------ @android:/system/bin # ./valgrind --leak-check=full --tool=memcheck -v sample ==268== Memcheck, a memory error detector ==268== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==268== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==268== Command: sample ==268== --268-- Valgrind options: --268-- --leak-check=full --268-- --tool=memcheck --268-- -v --268-- Contents of /proc/version: --268-- Linux version 3.4.42-eng-gcd82698-00002-g6497f5b (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed May 21 17:30:16 IST 2014 --268-- Arch and hwcaps: ARM, ARMv7-vfp-neon --268-- Page sizes: currently 4096, max supported 4096 --268-- Valgrind library directory: /system/lib/valgrind --268-- Reading syms from /system/bin/sample --268-- Considering /system/bin/sample .. --268-- .. CRC mismatch (computed 918c9dfe wanted cde23cf7) --268-- object doesn't have a symbol table --268-- object doesn't have a dynamic symbol table --268-- Reading syms from /system/lib/valgrind/memcheck-arm-linux --268-- Considering /system/lib/valgrind/memcheck-arm-linux .. --268-- .. CRC mismatch (computed 9317450f wanted 4a9e0d91) --268-- object doesn't have a symbol table --268-- object doesn't have a dynamic symbol table --268-- Scheduler: using generic scheduler lock implementation. --268-- Reading suppressions file: /system/lib/valgrind/default.supp ==268== ==268== HEAP SUMMARY: ==268== in use at exit: 0 bytes in 0 blocks ==268== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==268== ==268== All heap blocks were freed -- no leaks are possible ==268== ==268== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==268== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Please help. Regards, Vignesh |