[petsc-users] Memory Accumulation
    Barry Smith 
    bsmith at mcs.anl.gov
       
    Thu Aug 30 18:18:05 CDT 2012
    
    
  
On Aug 30, 2012, at 6:08 PM, "Zhenglun (Alan) Wei" <zhenglun.wei at gmail.com> wrote:
> Dear All,
>    I hope you're having a nice day.
>    I coded my program based on the /src/ksp/ksp/example/tutorial/ex45.c. However, I met a problem that the memory is accumulating while the program is running. I have a doubt on the DMDAVecGetArray(da, b, &bb) and DMDAVecRestoreArray(da,b,&bb). Does the former one allocate any memory for 'bb'? If so, does the later one free the memory allocated for the 'bb'?
    You must match each  DMDAVecGetArray with a DMDAVecRestoreArray() or you may bleed memory
>    BTW, I just installed the Valgrind. Is there any useful commands in Valgrind can monitor the memory of all the arrays in my program in real time so that I can detect which array keeps requesting the memory?
    It is easy to simply using -malloc -malloc_debug -malloc_dump to see all the memory that was allocated and not freed.
   Barry
> 
> thanks,
> Alan
    
    
More information about the petsc-users
mailing list