[petsc-dev] MatCreateSubMatrices in parallel with n=0 on a process causes memory leak

Brad Aagaard baagaard at usgs.gov
Mon Mar 27 12:39:52 CDT 2017

PETSc developers,

In PyLith we call MatCreateSubMatrices() and MatDestroyMatrices() with 
potentially different numbers of submatrices on each process. If each 
process has a nonzero number of submatrices things appear to be working 
fine. If a process has zero submatrices, I am getting a memory leak on 
that process (as reported by -malloc_dump). I did not get this behavior 
with PETSc 3.7.2 and earlier with MatGetSubMatrices() and 

Do I need to do something special when calling MatCreateSubMatrices() or 
MatDestroyMatrices() when the number of submatrices on a process is zero?

The log with the petsc log summary and malloc dump output is attached.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: log.gz
Type: application/gzip
Size: 77177 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170327/eb006dc2/attachment.bin>

More information about the petsc-dev mailing list