[petsc-users] Calling MatDestroy on MatGetDiagonalBlock

Barry Smith bsmith at mcs.anl.gov
Tue Jan 5 17:32:18 CST 2016


  In general XXXGetYYY() do not increase the reference count and you should not destroy. Some XXXGetYYY() have a corresponding XXXRestoreYYY(). 

  XXXCreateYYY() DO increase the reference count and should have destroy called.

  So  get -> no destroy
        create -> destroy

  Barry

In the past we were not consistent between the usages but now I think it is consistent.


> On Jan 5, 2016, at 5:24 PM, Bhalla, Amneet Pal S <amneetb at live.unc.edu> wrote:
> 
> 
> 
>> On Jan 5, 2016, at 3:20 PM, Dave May <dave.mayhem23 at gmail.com> wrote:
>> 
>> This statement would imply that in the absence of calling PetscObjectReference() yourself, you should not call MatDestroy() on the matrix returned
> 
> Got it. Thanks!
> 



More information about the petsc-users mailing list