Skip to content
  • valgrind:

    $ /home/me/APPS/valgrind-3.18.1/bin/valgrind -s --leak-check=full ./test_simple     
    ==748203== Memcheck, a memory error detector
    ==748203== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==748203== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
    ==748203== Command: ./test_simple
    ==748203== 
    1 -6
    2 -5.25
    3 -4.5
    4 -3.75
    5 -3
    6 -2.25
    7 -1.5
    8 -0.75
    9 0
    10 0.75
    11 1.5
    12 2.25
    13 3
    14 3.75
    15 4.5
    ==748203== Invalid write of size 8
    ==748203==    at 0x1095B8: main (test_c++.cpp:47)
    ==748203==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==748203==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==748203==    by 0x109540: main (test_c++.cpp:45)
    ==748203== 
    ==748203== Invalid read of size 8
    ==748203==    at 0x1095F4: main (test_c++.cpp:48)
    ==748203==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==748203==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==748203==    by 0x109540: main (test_c++.cpp:45)
    ==748203== 
    16 5.25
    ==748203== 
    ==748203== HEAP SUMMARY:
    ==748203==     in use at exit: 0 bytes in 0 blocks
    ==748203==   total heap usage: 3 allocs, 3 frees, 73,856 bytes allocated
    ==748203== 
    ==748203== All heap blocks were freed -- no leaks are possible
    ==748203== 
    ==748203== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
    ==748203== 
    ==748203== 1 errors in context 1 of 2:
    ==748203== Invalid read of size 8
    ==748203==    at 0x1095F4: main (test_c++.cpp:48)
    ==748203==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==748203==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==748203==    by 0x109540: main (test_c++.cpp:45)
    ==748203== 
    ==748203== 
    ==748203== 1 errors in context 2 of 2:
    ==748203== Invalid write of size 8
    ==748203==    at 0x1095B8: main (test_c++.cpp:47)
    ==748203==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==748203==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==748203==    by 0x109540: main (test_c++.cpp:45)
    ==748203== 
    ==748203== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
    
  • en supprimant la ligne 47 dans le code, on a une erreur en moins

    $ /home/me/APPS/valgrind-3.18.1/bin/valgrind -s --leak-check=full ./test_simple     
    ==747608== Memcheck, a memory error detector
    ==747608== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==747608== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
    ==747608== Command: ./test_simple
    ==747608== 
    ==747608== Invalid write of size 8
    ==747608==    at 0x109534: main (test_c++.cpp:47)
    ==747608==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==747608==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==747608==    by 0x1094C0: main (test_c++.cpp:45)
    ==747608== 
    ==747608== 
    ==747608== HEAP SUMMARY:
    ==747608==     in use at exit: 0 bytes in 0 blocks
    ==747608==   total heap usage: 2 allocs, 2 frees, 72,832 bytes allocated
    ==747608== 
    ==747608== All heap blocks were freed -- no leaks are possible
    ==747608== 
    ==747608== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    ==747608== 
    ==747608== 1 errors in context 1 of 1:
    ==747608== Invalid write of size 8
    ==747608==    at 0x109534: main (test_c++.cpp:47)
    ==747608==  Address 0x4ec8d00 is 0 bytes after a block of size 128 alloc'd
    ==747608==    at 0x483E217: operator new[](unsigned long) (vg_replace_malloc.c:640)
    ==747608==    by 0x1094C0: main (test_c++.cpp:45)
    ==747608== 
    ==747608== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    
  • pour compiler (ça vient d'un cmake):

    c++ -g -O0 -std=c++11 -fopenmp -Wall -Wextra -Wconversion -Wshadow -Wpedantic CMakeFiles/test_fftw_simple.dir/test_fftw_simple.cpp.o  -o test_fftw_simple  /home/me/projets/CMake-hdf5-1.12.0/build/_CPack_Packages/Linux/TGZ/HDF5-1.12.0-Linux/HDF_Group/HDF5/1.12.0/lib/libhdf5.a /home/me/projets/CMake-hdf5-1.12.0/build/_CPack_Packages/Linux/TGZ/HDF5-1.12.0-Linux/HDF_Group/HDF5/1.12.0/lib/libhdf5_cpp.a -lfftw3l /home/me/projets/CMake-hdf5-1.12.0/build/_CPack_Packages/Linux/TGZ/HDF5-1.12.0-Linux/HDF_Group/HDF5/1.12.0/lib/libhdf5.a -ldl /home/me/projets/CMake-hdf5-1.12.0/build/_CPack_Packages/Linux/TGZ/HDF5-1.12.0-Linux/HDF_Group/HDF5/1.12.0/lib/libz.a /home/me/projets/CMake-hdf5-1.12.0/build/_CPack_Packages/Linux/TGZ/HDF5-1.12.0-Linux/HDF_Group/HDF5/1.12.0/lib/libszip.a -lm
    Edited by henry
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment