Thanks for the report. I ran the example with those options under Linux with valgrind and found no memory leaks, I cannot run valgrind on my Mac. I suspect the issue is related to some internal library memory problems on the Apple and is not in the PETSc library or that example.
Barry > On Feb 25, 2015, at 10:44 AM, Sascha Schnepp <m...@saschaschnepp.net> wrote: > > Hello, > > when I run ksp/ksp/examples/tutorials/ex2 through valgrind with random exact > vector enabled (-random_exact_sol) it shows some lost memory. Patrick Sanan > discovered this playing around with random positions of multiple inclusions > for ex43 but that is in a fork/branch of his. The part of the valgrind output > concerning the memory loss for ex2 with -random_exact_sol is identical. > > Cheers, > Sascha > > sascha@geop-304 …/ksp/examples/tutorials [master ↓333|?19] > 02/25/15 [17:29:26] $ valgrind --leak-check=full --dsymutil=yes ./ex2 ./ex2 > -ksp_monitor_short -m 5 -n 5 -ksp_gmres_cgs_refinement_type refine_always > -random_exact_sol==68417== Memcheck, a memory error detector > ==68417== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. > ==68417== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info > ==68417== Command: ./ex2 ./ex2 -ksp_monitor_short -m 5 -n 5 > -ksp_gmres_cgs_refinement_type refine_always -random_exact_sol > ==68417== > --68417-- run: /usr/bin/dsymutil "./ex2" > --68417-- run: /usr/bin/dsymutil > "/Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpifort.12.dylib" > --68417-- run: /usr/bin/dsymutil > "/Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpicxx.12.dylib" > --68417-- run: /usr/bin/dsymutil > "/Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpi.12.dylib" > --68417-- run: /usr/bin/dsymutil > "/Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libpmpi.12.dylib" > 0 KSP Residual norm 2.28401 > 1 KSP Residual norm 0.541581 > 2 KSP Residual norm 0.114601 > 3 KSP Residual norm 0.0109825 > 4 KSP Residual norm 0.00112854 > 5 KSP Residual norm 8.41066e-05 > Norm of error 9.07246e-05 iterations 5 > ==68417== > ==68417== HEAP SUMMARY: > ==68417== in use at exit: 44,377 bytes in 387 blocks > ==68417== total heap usage: 1,999 allocs, 1,612 frees, 328,837 bytes > allocated > ==68417== > ==68417== 1,060 bytes in 1 blocks are possibly lost in loss record 85 of 95 > ==68417== at 0x66BB: malloc (vg_replace_malloc.c:300) > ==68417== by 0x234DFC3: __emutls_get_address (in > /opt/local/lib/libgcc/libgcc_s.1.dylib) > ==68417== > ==68417== 2,080 (1,040 direct, 1,040 indirect) bytes in 1 blocks are > definitely lost in loss record 92 of 95 > ==68417== at 0x66BB: malloc (vg_replace_malloc.c:300) > ==68417== by 0x25175AE: atexit_register (in > /usr/lib/system/libsystem_c.dylib) > ==68417== by 0x25176E9: __cxa_atexit (in /usr/lib/system/libsystem_c.dylib) > ==68417== by 0x1E3CC27: _GLOBAL__sub_I_initcxx.cxx (initcxx.cxx:110) > ==68417== by 0x7FFF5FC3D15F: ??? > ==68417== by 0x1E3C28F: MPI::Datatype::Get_name(char*, int&) const (in > /Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpicxx.12.dylib) > ==68417== by 0x10480D61F: ??? > ==68417== by 0x7FFF5FC11C2D: > ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in > /usr/lib/dyld) > ==68417== by 0x7FFF5FC3D15F: ??? > ==68417== by 0x100000011: ??? (in ./ex2) > ==68417== by 0x1E35297: ??? (in > /Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpicxx.12.dylib) > ==68417== by 0x1E3555F: ??? (in > /Users/sascha/Documents/codes/PETSc/petsc-dev/arch-osx-master-debug/lib/libmpicxx.12.dylib) > ==68417== > ==68417== LEAK SUMMARY: > ==68417== definitely lost: 1,040 bytes in 1 blocks > ==68417== indirectly lost: 1,040 bytes in 1 blocks > ==68417== possibly lost: 1,060 bytes in 1 blocks > ==68417== still reachable: 5,318 bytes in 15 blocks > ==68417== suppressed: 35,919 bytes in 369 blocks > ==68417== Reachable blocks (those to which a pointer was found) are not shown. > ==68417== To see them, rerun with: --leak-check=full --show-leak-kinds=all > ==68417== > ==68417== For counts of detected and suppressed errors, rerun with: -v > ==68417== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 17 from 17) > > <configure.log><make.log>