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

Hong hzhang at mcs.anl.gov
Mon Mar 27 15:12:30 CDT 2017


Brad:
I updated the help menu
https://bitbucket.org/petsc/petsc/commits/7526cb21428e6e453a7c940d78502e96d2c8a4bd

Thanks for your report.
Hong

>
> On 03/27/2017 12:57 PM, Hong wrote:
>
>>
>>
>> Brad:
>> You must call MatDestroySubMatrices(), not MatDestroyMatrices().
>> See petsc/src/mat/examples/tests/ex54.c
>>
>> I'll add it to the help menu of MatCreateSubMatrices().
>>
>> Hong
>>
>>
>>
>>     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 MatDestroyMatrices().
>>
>>     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.
>>
>>     Thanks,
>>     Brad
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170327/b1d06f70/attachment.html>


More information about the petsc-dev mailing list