memory check: error message from valgrind

(Rebecca) Xuefei YUAN xy2102 at columbia.edu
Tue May 5 16:46:41 CDT 2009


Hi,

I am using valgrind to check the memory leaking and it turned out that  
I got 3 errors and they were happening at the the PetscInitialize(),  
and DACreate2d()

line 79: PetscInitialize(&argc, &argv, (char*)0, help);
line 84: ierr = DACreate2d(comm,DA_XPERIODIC,DA_STENCIL_BOX, -5, -5,  
PETSC_DECIDE, PETSC_DECIDE, 4, 2, 0, 0, &da);CHKERRQ(ierr);


What could be wrong here? Thanks!

The following is the message from valgrind

-----------------------------------------------------------------
  valgrind --leak-check=full --show-reachable=yes --tool=memcheck  
./vdthpffxmhd -options_file option_ffxmhd>output
==26665== Memcheck, a memory error detector.
==26665== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==26665== Using LibVEX rev 1804, a library for dynamic binary translation.
==26665== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==26665== Using valgrind-3.3.0-Debian, a dynamic binary  
instrumentation framework.
==26665== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==26665== For more details, rerun with: -v
==26665==
==26665== Invalid read of size 4
==26665==    at 0x40151F9: (within /lib/ld-2.7.so)
==26665==    by 0x4005C59: (within /lib/ld-2.7.so)
==26665==    by 0x4007A87: (within /lib/ld-2.7.so)
==26665==    by 0x4011533: (within /lib/ld-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x4010F4D: (within /lib/ld-2.7.so)
==26665==    by 0x42C0291: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x42C0454: __libc_dlopen_mode (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A186: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A29F: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429BEC5: __nss_hosts_lookup (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==  Address 0x432af8c is 36 bytes inside a block of size 37 alloc'd
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x4008021: (within /lib/ld-2.7.so)
==26665==    by 0x4011533: (within /lib/ld-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x4010F4D: (within /lib/ld-2.7.so)
==26665==    by 0x42C0291: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x42C0454: __libc_dlopen_mode (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A186: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A29F: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429BEC5: __nss_hosts_lookup (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x42A0782: gethostbyname_r (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==
==26665== Invalid read of size 4
==26665==    at 0x40151E3: (within /lib/ld-2.7.so)
==26665==    by 0x4005C59: (within /lib/ld-2.7.so)
==26665==    by 0x4007A87: (within /lib/ld-2.7.so)
==26665==    by 0x4011533: (within /lib/ld-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x4010F4D: (within /lib/ld-2.7.so)
==26665==    by 0x42C0291: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x42C0454: __libc_dlopen_mode (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A186: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4731FFB: (within /lib/tls/i686/cmov/libnss_compat-2.7.so)
==26665==    by 0x473313C: _nss_compat_getpwuid_r (in  
/lib/tls/i686/cmov/libnss_compat-2.7.so)
==26665==  Address 0x432c1f8 is 32 bytes inside a block of size 35 alloc'd
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x4008021: (within /lib/ld-2.7.so)
==26665==    by 0x4011533: (within /lib/ld-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x4010F4D: (within /lib/ld-2.7.so)
==26665==    by 0x42C0291: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x400D5C5: (within /lib/ld-2.7.so)
==26665==    by 0x42C0454: __libc_dlopen_mode (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429A186: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4731FFB: (within /lib/tls/i686/cmov/libnss_compat-2.7.so)
==26665==    by 0x473313C: _nss_compat_getpwuid_r (in  
/lib/tls/i686/cmov/libnss_compat-2.7.so)
==26665==    by 0x4246D15: getpwuid_r (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==
==26665== ERROR SUMMARY: 3 errors from 2 contexts (suppressed: 41 from 1)
==26665== malloc/free: in use at exit: 64,352 bytes in 87 blocks.
==26665== malloc/free: 2,472 allocs, 2,385 frees, 3,015,115 bytes allocated.
==26665== For counts of detected errors, rerun with: -v
==26665== searching for pointers to 87 not-freed blocks.
==26665== checked 1,120,136 bytes.
==26665==
==26665==
==26665== 32 bytes in 2 blocks are still reachable in loss record 1 of 5
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x871B2A8: MPID_VCRT_Create (mpid_vc.c:62)
==26665==    by 0x8718C6A: MPID_Init (mpid_init.c:116)
==26665==    by 0x86F1C3B: MPIR_Init_thread (initthread.c:288)
==26665==    by 0x86F175D: PMPI_Init (init.c:106)
==26665==    by 0x86355A1: PetscInitialize (pinit.c:503)
==26665==    by 0x804B627: main (vdthpffxmhd.c:79)
==26665==
==26665==
==26665== 156 (36 direct, 120 indirect) bytes in 1 blocks are  
definitely lost in loss record 2 of 5
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x429A3E2: (within /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x429AC2D: __nss_database_lookup (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4731FDB: ???
==26665==    by 0x473313C: ???
==26665==    by 0x4246D15: getpwuid_r (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x424665D: getpwuid (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x8644D41: PetscGetUserName (fuser.c:68)
==26665==    by 0x8602528: PetscErrorPrintfInitialize (errtrace.c:68)
==26665==    by 0x863565B: PetscInitialize (pinit.c:518)
==26665==    by 0x804B627: main (vdthpffxmhd.c:79)
==26665==
==26665==
==26665== 40 bytes in 5 blocks are indirectly lost in loss record 3 of 5
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x4299FBB: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4731FFB: ???
==26665==    by 0x473313C: ???
==26665==    by 0x4246D15: getpwuid_r (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x424665D: getpwuid (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x8644D41: PetscGetUserName (fuser.c:68)
==26665==    by 0x8602528: PetscErrorPrintfInitialize (errtrace.c:68)
==26665==    by 0x863565B: PetscInitialize (pinit.c:518)
==26665==    by 0x804B627: main (vdthpffxmhd.c:79)
==26665==
==26665==
==26665== 80 bytes in 5 blocks are indirectly lost in loss record 4 of 5
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x428739B: tsearch (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4299F7D: __nss_lookup_function (in  
/lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x4731FFB: ???
==26665==    by 0x473313C: ???
==26665==    by 0x4246D15: getpwuid_r (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x424665D: getpwuid (in /lib/tls/i686/cmov/libc-2.7.so)
==26665==    by 0x8644D41: PetscGetUserName (fuser.c:68)
==26665==    by 0x8602528: PetscErrorPrintfInitialize (errtrace.c:68)
==26665==    by 0x863565B: PetscInitialize (pinit.c:518)
==26665==    by 0x804B627: main (vdthpffxmhd.c:79)
==26665==
==26665==
==26665== 64,164 bytes in 74 blocks are still reachable in loss record 5 of 5
==26665==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==26665==    by 0x8610BE4: PetscMallocAlign (mal.c:40)
==26665==    by 0x8611CD3: PetscTrMallocDefault (mtr.c:194)
==26665==    by 0x81DE577: DACreate2d (da2.c:364)
==26665==    by 0x804B701: main (vdthpffxmhd.c:84)
==26665==
==26665== LEAK SUMMARY:
==26665==    definitely lost: 36 bytes in 1 blocks.
==26665==    indirectly lost: 120 bytes in 10 blocks.
==26665==      possibly lost: 0 bytes in 0 blocks.
==26665==    still reachable: 64,196 bytes in 76 blocks.
==26665==         suppressed: 0 bytes in 0 blocks.


------------------------------------------------------------------
-- 
(Rebecca) Xuefei YUAN
Department of Applied Physics and Applied Mathematics
Columbia University
Tel:917-399-8032
www.columbia.edu/~xy2102



More information about the petsc-users mailing list