|
From: Sylwester A. <sl...@ig...> - 2011-12-28 11:35:59
|
Hi,
Trying to use Valgrind on OS X (3.7.0 installed via macports)
I've came across the following problem:
> eyrie:Temp slayoo$ cat test.cpp
> #include <malloc/malloc.h>
> int main()
> {
> static malloc_statistics_t stats;
> malloc_zone_statistics(malloc_default_zone(), &stats);
> }
> eyrie:Temp slayoo$ g++ test.cpp
> eyrie:Temp slayoo$ ./a.out && echo OK
> OK
> eyrie:Temp slayoo$ valgrind ./a.out
> ==618== Memcheck, a memory error detector
> ==618== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==618== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==618== Command: ./a.out
> ==618==
> --618-- ./a.out:
> --618-- dSYM directory is missing; consider using --dsymutil=yes
> ==618== Invalid read of size 8
> ==618== at 0x100156BE3: malloc_zone_statistics (in /usr/lib/libSystem.B.dylib)
> ==618== by 0x100000F07: main (in ./a.out)
> ==618== Address 0x38 is not stack'd, malloc'd or (recently) free'd
> ==618==
> ==618==
> ==618== Process terminating with default action of signal 11 (SIGSEGV)
> ==618== Access not within mapped region at address 0x38
> ==618== at 0x100156BE3: malloc_zone_statistics (in /usr/lib/libSystem.B.dylib)
> ==618== by 0x100000F07: main (in ./a.out)
> ==618== If you believe this happened as a result of a stack
> ==618== overflow in your program's main thread (unlikely but
> ==618== possible), you can try to increase the size of the
> ==618== main thread stack using the --main-stacksize= flag.
> ==618== The main thread stack size used in this run was 8388608.
> ==618==
> ==618== HEAP SUMMARY:
> ==618== in use at exit: 88 bytes in 1 blocks
> ==618== total heap usage: 1 allocs, 0 frees, 88 bytes allocated
> ==618==
> ==618== LEAK SUMMARY:
> ==618== definitely lost: 0 bytes in 0 blocks
> ==618== indirectly lost: 0 bytes in 0 blocks
> ==618== possibly lost: 0 bytes in 0 blocks
> ==618== still reachable: 0 bytes in 0 blocks
> ==618== suppressed: 88 bytes in 1 blocks
> ==618==
> ==618== For counts of detected and suppressed errors, rerun with: -v
> ==618== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
> Segmentation fault
Any suggestions on what's wrong?
I'm trying to debug a program where malloc_zone_statistics()
is called at startup so this issue stops me from having
any meaningful results from Valgrind.
Thanks,
Sylwester
--
http://www.igf.fuw.edu.pl/~slayoo/
Please consider your environmental responsibility before printing this e-mail.
|