Code:
==9371== Invalid read of size 4
==9371== at 0x8050C4A: main (entropy.cpp:105)
==9371== Address 0x4a150f4 is 0 bytes after a block of size 396 alloc'd
==9371== at 0x4024025: operator new(unsigned) (vg_replace_malloc.c:224)
==9371== by 0x8055723: std::vector<int, std::allocator<int> >::_M_fill_insert(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, unsigned, int const&) (new_allocator.h:91)
==9371== by 0x8050B09: main (stl_vector.h:653)
k = 29
k = 30
k = 31
k = 32
k = 33
k = 34
k = 35
k = 36
k = 37
k = 38
k = 39
k = 40
k = 41
k = 42
k = 43
k = 44
k = 45
k = 46
k = 47
k = 48
k = 49
k = 50
k = 51
k = 52
OK
P(F,C) done
==9371==
==9371== ERROR SUMMARY: 224 errors from 1 contexts (suppressed: 28 from 1)
==9371== malloc/free: in use at exit: 0 bytes in 0 blocks.
==9371== malloc/free: 707,923 allocs, 707,923 frees, 2,107,823,781 bytes allocated.
==9371== For counts of detected errors, rerun with: -v
==9371== All heap blocks were freed -- no leaks are possible.
mockset #
mockset # valgrind --leak-check=yes entropy spec.json x3-truth-map.txt *h5 -v
==9374== Memcheck, a memory error detector.
==9374== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==9374== Using LibVEX rev 1854, a library for dynamic binary translation.
==9374== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==9374== Using valgrind-3.3.1, a dynamic binary instrumentation framework.
==9374== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==9374== For more details, rerun with: -v
==9374==
... Indexing truthmap ... OK
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::resize
... Indexing filenames ... ==9374==
==9374== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 1)
==9374== malloc/free: in use at exit: 791,127 bytes in 21,938 blocks.
==9374== malloc/free: 133,693 allocs, 111,755 frees, 9,435,638 bytes allocated.
==9374== For counts of detected errors, rerun with: -v
==9374== searching for pointers to 21,938 not-freed blocks.
==9374== checked 988,264 bytes.
==9374==
==9374== 5,820 bytes in 116 blocks are possibly lost in loss record 26 of 31
==9374== at 0x40237F9: malloc (vg_replace_malloc.c:207)
==9374== by 0x40F6474: H5FL_malloc (in /prog/lib/hdf5-1.8.1/hdf5/lib/libhdf5.so.5.0.1)
==9374==
==9374==
==9374== 386,444 bytes in 9,887 blocks are possibly lost in loss record 31 of 31
==9374== at 0x4024025: operator new(unsigned) (vg_replace_malloc.c:224)
==9374== by 0x43519F0: std::string::_Rep::_S_create(unsigned, unsigned, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9)
==9374== by 0x4352CF4: (within /usr/lib/libstdc++.so.6.0.9)
==9374== by 0x4352EA6: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9)
==9374== by 0x808449C: __static_initialization_and_destruction_0(int, int) (in /prog/igor/src/entropy/entropy)
==9374== by 0x8084504: _GLOBAL__I__ZN2H59Exception11DEFAULT_MSGE (in /prog/igor/src/entropy/entropy)
==9374== by 0x80A2DB4: (within /prog/igor/src/entropy/entropy)
==9374== by 0x804E24B: (within /prog/igor/src/entropy/entropy)
==9374== by 0x80A2D58: __libc_csu_init (in /prog/igor/src/entropy/entropy)
==9374== by 0x4446330: (below main) (in /lib/libc-2.7.so)
==9374==
==9374== LEAK SUMMARY:
==9374== definitely lost: 0 bytes in 0 blocks.
==9374== possibly lost: 392,264 bytes in 10,003 blocks.
==9374== still reachable: 398,863 bytes in 11,935 blocks.
==9374== suppressed: 0 bytes in 0 blocks.
==9374== Reachable blocks (those to which a pointer was found) are not shown.
==9374== To see them, rerun with: --leak-check=full --show-reachable=yes