Dear Matt, I did run with valgrind, and the error message is for a DAGetLocalVector() in FormFunction() which is not related to this structure.
Thanks very much! Here is the details from valgrind: ==4871== Invalid write of size 8 ==4871== at 0x8070D09: FormFunction (twgcqt2unffnictvscj.c:2654) ==4871== by 0x80D8026: SNESComputeFunction (snes.c:1093) ==4871== by 0x8100AB2: SNESSolve_LS (ls.c:159) ==4871== by 0x80E0D43: SNESSolve (snes.c:2242) ==4871== by 0x80FA8C8: DMMGSolveSNES (damgsnes.c:510) ==4871== by 0x80F3DC0: DMMGSolve (damg.c:313) ==4871== by 0x8052ECB: Solve (twgcqt2unffnictvscj.c:678) ==4871== by 0x804DEF4: main (twgcqt2unffnictvscj.c:302) ==4871== Address 0x464aea8 is 4 bytes after a block of size 17,092 alloc'd ==4871== at 0x4021E01: memalign (vg_replace_malloc.c:532) ==4871== by 0x873A8B4: PetscMallocAlign (mal.c:33) ==4871== by 0x873B9EB: PetscTrMallocDefault (mtr.c:194) ==4871== by 0x8686B80: VecCreate_Seq (bvec2.c:809) ==4871== by 0x866C373: VecSetType (vecreg.c:54) ==4871== by 0x86923DB: VecCreateSeq (vseqcr.c:40) ==4871== by 0x8271215: DACreateLocalVector (dalocal.c:82) ==4871== by 0x82B9E70: DMCreateLocalVector (dm.c:115) ==4871== by 0x82716E7: DMGetLocalVector (dalocal.c:139) ==4871== by 0x8070719: FormFunction (twgcqt2unffnictvscj.c:2629) ==4871== by 0x80D8026: SNESComputeFunction (snes.c:1093) ==4871== by 0x8100AB2: SNESSolve_LS (ls.c:159) ==4871== ==4871== Invalid write of size 8 ==4871== at 0x8070D46: FormFunction (twgcqt2unffnictvscj.c:2655) ==4871== by 0x80D8026: SNESComputeFunction (snes.c:1093) ==4871== by 0x8100AB2: SNESSolve_LS (ls.c:159) ==4871== by 0x80E0D43: SNESSolve (snes.c:2242) ==4871== by 0x80FA8C8: DMMGSolveSNES (damgsnes.c:510) ==4871== by 0x80F3DC0: DMMGSolve (damg.c:313) ==4871== by 0x8052ECB: Solve (twgcqt2unffnictvscj.c:678) ==4871== by 0x804DEF4: main (twgcqt2unffnictvscj.c:302) ==4871== Address 0x464aeb0 is 12 bytes after a block of size 17,092 alloc'd ==4871== at 0x4021E01: memalign (vg_replace_malloc.c:532) ==4871== by 0x873A8B4: PetscMallocAlign (mal.c:33) ==4871== by 0x873B9EB: PetscTrMallocDefault (mtr.c:194) ==4871== by 0x8686B80: VecCreate_Seq (bvec2.c:809) ==4871== by 0x866C373: VecSetType (vecreg.c:54) ==4871== by 0x86923DB: VecCreateSeq (vseqcr.c:40) ==4871== by 0x8271215: DACreateLocalVector (dalocal.c:82) ==4871== by 0x82B9E70: DMCreateLocalVector (dm.c:115) ==4871== by 0x82716E7: DMGetLocalVector (dalocal.c:139) ==4871== by 0x8070719: FormFunction (twgcqt2unffnictvscj.c:2629) ==4871== by 0x80D8026: SNESComputeFunction (snes.c:1093) ==4871== by 0x8100AB2: SNESSolve_LS (ls.c:159) ==4871== [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Floating point exception! [0]PETSC ERROR: User provided compute function generated a Not-a-Number! [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: Petsc Development HG revision: unknown HG Date: unknown [0]PETSC ERROR: See docs/changes/index.html for recent updates. [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. [0]PETSC ERROR: See docs/index.html for manual pages. [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: ./twgcqt2unffnictvscj.exe on a linux-gnu named YuanWork by rebecca Sat Apr 17 10:09:32 2010 [0]PETSC ERROR: Libraries linked from /home/rebecca/soft/petsc-dev/linux-gnu-c-debug/lib [0]PETSC ERROR: Configure run at Tue Jan 26 13:06:44 2010 [0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=0 --download-c-blas-lapack=/home/rebecca/soft/petsc-dev/f2cblaslapack-3.1.1.tar.gz --download-mpich=/home/rebecca/soft/petsc-dev/mpich2-1.2.1.tar.gz --download-sowing=/home/rebecca/soft/petsc-dev/sowing-1.1.15.tar.gz --download-c2html=/home/rebecca/soft/petsc-dev/c2html.tar.gz --with-shared=0 [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: SNESSolve_LS() line 168 in src/snes/impls/ls/ls.c [0]PETSC ERROR: SNESSolve() line 2242 in src/snes/interface/snes.c [0]PETSC ERROR: DMMGSolveSNES() line 510 in src/snes/utils/damgsnes.c [0]PETSC ERROR: DMMGSolve() line 313 in src/snes/utils/damg.c [0]PETSC ERROR: Solve() line 678 in twgcqt2unffnictvscj.c [0]PETSC ERROR: main() line 302 in twgcqt2unffnictvscj.c application called MPI_Abort(MPI_COMM_WORLD, 72) - process 0 [unset]: aborting job: application called MPI_Abort(MPI_COMM_WORLD, 72) - process 0 ==4871== ==4871== HEAP SUMMARY: ==4871== in use at exit: 983,336 bytes in 1,927 blocks ==4871== total heap usage: 4,540 allocs, 2,583 frees, 3,421,236 bytes allocated ==4871== ==4871== LEAK SUMMARY: ==4871== definitely lost: 1,780 bytes in 13 blocks ==4871== indirectly lost: 120 bytes in 10 blocks ==4871== possibly lost: 963,492 bytes in 1,837 blocks ==4871== still reachable: 20,820 bytes in 97 blocks ==4871== suppressed: 0 bytes in 0 blocks ==4871== Rerun with --leak-check=full to see details of leaked memory ==4871== ==4871== For counts of detected and suppressed errors, rerun with: -v ==4871== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 40 from 10) Quoting Matthew Knepley <knepley at gmail.com>: > This means there is memory corruption. I would use valgrind to find it. > > Matt > > On Sat, Apr 17, 2010 at 8:35 AM, (Rebecca) Xuefei YUAN > <xy2102 at columbia.edu>wrote: > >> Hi, >> >> I got a message of glibc detected, and not sure where is it coming from, >> any ideas? >> >> What I have changed from a working copy to this one is to add an element in >> one of the structure which in the appCtx. >> >> Thanks very much! >> ----------------------------------------------------------------------- >> (gdb) c >> Continuing. >> *** glibc detected *** >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe: >> free(): invalid next size (normal): 0x08b10750 *** >> ======= Backtrace: ========= >> /lib/tls/i686/cmov/libc.so.6[0xb7d9da85] >> /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7da14f0] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x873a938] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x873c43b] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x872e8f0] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x866c211] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x86a4768] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x8276048] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x80729e1] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x80d8027] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x8100ab3] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x80e0d44] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x80fa8c9] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x80f3dc1] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x8052ecc] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x804def5] >> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7d48450] >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe[0x804b451] >> ======= Memory map: ======== >> 08048000-08918000 r-xp 00000000 08:06 3910764 >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe >> 08918000-0891e000 rw-p 008cf000 08:06 3910764 >> >> /home/rebecca/linux/code/twoway/twoway_new/workingspace/twgcqt2unffnictvscj.exe >> 0891e000-08b1f000 rw-p 0891e000 00:00 0 [heap] >> b7b00000-b7b21000 rw-p b7b00000 00:00 0 >> b7b21000-b7c00000 ---p b7b21000 00:00 0 >> b7cef000-b7cf7000 r-xp 00000000 08:05 344321 /lib/tls/i686/cmov/ >> libnss_nis-2.7.so >> b7cf7000-b7cf9000 rw-p 00007000 08:05 344321 /lib/tls/i686/cmov/ >> libnss_nis-2.7.so >> b7cf9000-b7d00000 r-xp 00000000 08:05 344317 /lib/tls/i686/cmov/ >> libnss_compat-2.7.so >> b7d00000-b7d02000 rw-p 00006000 08:05 344317 /lib/tls/i686/cmov/ >> libnss_compat-2.7.so >> b7d02000-b7d0b000 r-xp 00000000 08:05 344319 /lib/tls/i686/cmov/ >> libnss_files-2.7.so >> b7d0b000-b7d0d000 rw-p 00008000 08:05 344319 /lib/tls/i686/cmov/ >> libnss_files-2.7.so >> b7d0d000-b7d0f000 rw-p b7d0d000 00:00 0 >> b7d0f000-b7d13000 r-xp 00000000 08:05 179791 /usr/lib/libXdmcp.so.6.0.0 >> b7d13000-b7d14000 rw-p 00003000 08:05 179791 /usr/lib/libXdmcp.so.6.0.0 >> b7d14000-b7d16000 r-xp 00000000 08:05 179780 /usr/lib/libXau.so.6.0.0 >> b7d16000-b7d17000 rw-p 00001000 08:05 179780 /usr/lib/libXau.so.6.0.0 >> b7d17000-b7d2e000 r-xp 00000000 08:05 180628 /usr/lib/libxcb.so.1.0.0 >> b7d2e000-b7d2f000 rw-p 00016000 08:05 180628 /usr/lib/libxcb.so.1.0.0 >> b7d2f000-b7d30000 rw-p b7d2f000 00:00 0 >> b7d30000-b7d31000 r-xp 00000000 08:05 180626 >> /usr/lib/libxcb-xlib.so.0.0.0 >> b7d31000-b7d32000 rw-p 00000000 08:05 180626 >> /usr/lib/libxcb-xlib.so.0.0.0 >> b7d32000-b7e7b000 r-xp 00000000 08:05 344310 /lib/tls/i686/cmov/ >> libc-2.7.so >> b7e7b000-b7e7c000 r--p 00149000 08:05 344310 /lib/tls/i686/cmov/ >> libc-2.7.so >> b7e7c000-b7e7e000 rw-p 0014a000 08:05 344310 /lib/tls/i686/cmov/ >> libc-2.7.so >> b7e7e000-b7e81000 rw-p b7e7e000 00:00 0 >> b7e81000-b7e95000 r-xp 00000000 08:05 344324 /lib/tls/i686/cmov/ >> libpthread-2.7.so >> b7e95000-b7e97000 rw-p 00013000 08:05 344324 /lib/tls/i686/cmov/ >> libpthread-2.7.so >> b7e97000-b7e99000 rw-p b7e97000 00:00 0 >> b7e99000-b7e9b000 r-xp 00000000 08:05 344313 /lib/tls/i686/cmov/ >> libdl-2.7.so >> b7e9b000-b7e9d000 rw-p 00001000 08:05 344313 /lib/tls/i686/cmov/ >> libdl-2.7.so >> b7e9d000-b7ea4000 r-xp 00000000 08:05 344326 /lib/tls/i686/cmov/ >> librt-2.7.so >> b7ea4000-b7ea6000 rw-p 00006000 08:05 344326 /lib/tls/i686/cmov/ >> librt-2.7.so >> b7ea6000-b7eba000 r-xp 00000000 08:05 344316 /lib/tls/i686/cmov/ >> libnsl-2.7.so >> b7eba000-b7ebc000 rw-p 00013000 08:05 344316 /lib/tls/i686/cmov/ >> libnsl-2.7.so >> b7ebc000-b7ebf000 rw-p b7ebc000 00:00 0 >> b7ebf000-b7ee2000 r-xp 00000000 08:05 344314 /lib/tls/i686/cmov/ >> libm-2.7.so >> b7ee2000-b7ee4000 rw-p 00023000 08:05 344314 /lib/tls/i686/cmov/ >> libm-2.7.so >> b7ee4000-b7fc8000 r-xp 00000000 08:05 179774 /usr/lib/libX11.so.6.2.0 >> b7fc8000-b7fcb000 rw-p 000e4000 08:05 179774 /usr/lib/libX11.so.6.2.0 >> b7fcf000-b7fd9000 r-xp 00000000 08:05 308438 /lib/libgcc_s.so.1 >> b7fd9000-b7fda000 rw-p 0000a000 08:05 308438 /lib/libgcc_s.so.1 >> b7fda000-b7fdd000 rw-p b7fda000 00:00 0 >> b7fdd000-b7fde000 r-xp b7fdd000 00:00 0 [vdso] >> b7fde000-b7ff8000 r-xp 00000000 08:05 309874 /lib/ld-2.7.so >> b7ff8000-b7ffa000 rw-p 00019000 08:05 309874 /lib/ld-2.7.so >> bfb4a000-bfb5f000 rw-p bffeb000 00:00 0 [stack] >> >> Program received signal SIGABRT, Aborted. >> 0xb7fdd410 in __kernel_vsyscall () >> >> >> -- >> (Rebecca) Xuefei YUAN >> Department of Applied Physics and Applied Mathematics >> Columbia University >> Tel:917-399-8032 >> www.columbia.edu/~xy2102 >> >> > > > -- > What most experimenters take for granted before they begin their experiments > is infinitely more interesting than any results to which their experiments > lead. > -- Norbert Wiener > -- (Rebecca) Xuefei YUAN Department of Applied Physics and Applied Mathematics Columbia University Tel:917-399-8032 www.columbia.edu/~xy2102