[petsc-users] Mat Destroy

Michael Povolotskyi mpovolot at purdue.edu
Sun Aug 25 07:38:39 CDT 2013


On 8/23/2013 7:37 PM, Jed Brown wrote:
> Barry Smith <bsmith at mcs.anl.gov> writes:
>>     We call free() at that point. But not that in Unix this does not
>>     mean the memory is returned to the operating system so you will not
>>     see the process memory go down.  If you then allocate new objects
>>     they will reuse this memory.
> Also note that MatDestroy only releases a references, so if another
> object still holds a reference to your matrix, nothing will be freed.
Thank you!
Just to clarify: if a code reads like this:

Mat A;
MatCreate(MPI_COMM_WORLD, &A);

Mat B = A;
....
MatDestroy(&B);

Will the free() function be called for the memory that contains the 
matrix data in this case?
Thank you,
Michael.


More information about the petsc-users mailing list