Skip to content

Instantly share code, notes, and snippets.

@adaedra
Created December 13, 2012 22:16
Show Gist options
  • Save adaedra/4280564 to your computer and use it in GitHub Desktop.
Save adaedra/4280564 to your computer and use it in GitHub Desktop.
Apple's memory & valgrind fail
adaedra@pegasus % cd /tmp
adaedra@pegasus % echo "int main(void) { }" > memory_fail.c
adaedra@pegasus % gcc -o memory_fail memory_fail.c
adaedra@pegasus % valgrind ./memory_fail
==2086== Memcheck, a memory error detector
==2086== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2086== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2086== Command: ./memory_fail
==2086==
==2086== WARNING: Support on MacOS 10.8 is experimental and mostly broken.
==2086== WARNING: Expect incorrect results, assertions and crashes.
==2086== WARNING: In particular, Memcheck on 32-bit programs will fail to
==2086== WARNING: detect any errors associated with heap-allocated data.
==2086==
--2086-- ./memory_fail:
--2086-- dSYM directory is missing; consider using --dsymutil=yes
==2086== Syscall param exit(status) contains uninitialised byte(s)
==2086== at 0x23BAEA: _exit (in /usr/lib/system/libsystem_kernel.dylib)
==2086==
==2086==
==2086== HEAP SUMMARY:
==2086== in use at exit: 58,752 bytes in 362 blocks
==2086== total heap usage: 515 allocs, 153 frees, 62,706 bytes allocated
==2086==
==2086== LEAK SUMMARY:
==2086== definitely lost: 8,624 bytes in 14 blocks
==2086== indirectly lost: 1,168 bytes in 5 blocks
==2086== possibly lost: 4,941 bytes in 67 blocks
==2086== still reachable: 44,019 bytes in 276 blocks
==2086== suppressed: 0 bytes in 0 blocks
==2086== Rerun with --leak-check=full to see details of leaked memory
==2086==
==2086== For counts of detected and suppressed errors, rerun with: -v
==2086== Use --track-origins=yes to see where uninitialised values come from
==2086== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
adaedra@pegasus %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment