Skip to content

Instantly share code, notes, and snippets.

@vegard
Created February 13, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vegard/99d385fe607057f8104f15818a5a53e7 to your computer and use it in GitHub Desktop.
Save vegard/99d385fe607057f8104f15818a5a53e7 to your computer and use it in GitHub Desktop.
$ echo -n '' > empty.zig && valgrind ./zig build-obj empty.zig
==15795== Memcheck, a memory error detector
==15795== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==15795== Using Valgrind-3.13.0.SVN and LibVEX; rerun with -h for copyright info
==15795== Command: ./zig build-obj empty.zig
==15795==
==15795== Mismatched free() / delete / delete []
==15795== at 0x4C2F160: operator delete(void*) (vg_replace_malloc.c:576)
==15795== by 0x56F733D: llvm::PMTopLevelManager::~PMTopLevelManager() (in /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1)
==15795== by 0x56F8288: ??? (in /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1)
==15795== by 0x56F8A40: llvm::legacy::FunctionPassManager::~FunctionPassManager() (in /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1)
==15795== by 0x98854B: ZigLLVMTargetMachineEmitToFile (zig_llvm.cpp:152)
==15795== by 0x7CDE0D: do_code_gen(CodeGen*) (codegen.cpp:4952)
==15795== by 0x7DAAD3: codegen_build(CodeGen*) (codegen.cpp:6334)
==15795== by 0x6B01C3: main (main.cpp:873)
==15795== Address 0xeecb3c0 is 0 bytes inside a block of size 224 alloc'd
==15795== at 0x4C2DBB6: malloc (vg_replace_malloc.c:299)
==15795== by 0x986AF7: create<llvm::TargetLibraryInfoWrapperPass, llvm::TargetLibraryInfoImpl> (zig_llvm.cpp:56)
==15795== by 0x986AF7: ZigLLVMTargetMachineEmitToFile (zig_llvm.cpp:153)
==15795== by 0x7CDE0D: do_code_gen(CodeGen*) (codegen.cpp:4952)
==15795== by 0x7DAAD3: codegen_build(CodeGen*) (codegen.cpp:6334)
==15795== by 0x6B01C3: main (main.cpp:873)
==15795==
==15795==
==15795== HEAP SUMMARY:
==15795== in use at exit: 48,342,405 bytes in 315,897 blocks
==15795== total heap usage: 450,289 allocs, 134,392 frees, 116,935,102 bytes allocated
==15795==
==15795== LEAK SUMMARY:
==15795== definitely lost: 2,570,674 bytes in 27,059 blocks
==15795== indirectly lost: 3,733,290 bytes in 48,729 blocks
==15795== possibly lost: 40,425,895 bytes in 226,555 blocks
==15795== still reachable: 1,612,546 bytes in 13,554 blocks
==15795== of which reachable via heuristic:
==15795== length64 : 40 bytes in 1 blocks
==15795== newarray : 8,488 bytes in 42 blocks
==15795== multipleinheritance: 78,736 bytes in 1 blocks
==15795== suppressed: 0 bytes in 0 blocks
==15795== Rerun with --leak-check=full to see details of leaked memory
==15795==
==15795== For counts of detected and suppressed errors, rerun with: -v
==15795== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment