memory bleeding

Jordi Marcé Nogué jordi.marce at upc.edu
Tue May 9 11:09:28 CDT 2006


Hi,

I find my problem with the memory. Using  PetscTrDump(PETSC_NULL) I've 
cornered it and I've find the lines which generate it.

I've discovered that the functions like MatTranspose(), MatMatMult() or 
similar functions creates extra memory in my code and these don't destroy.

I explain:

I create my matrices ----->>>>   3000 b are created (for example)
I use MatMatMult --------->>>>   2000 bytes are created (for example)
I destroy my matrices ---->>>>   3000 b are destroyed.

How can I free the memory created in the function MaMatMult()?

The final result is that if I use this function in a iterative process I 
full the memory of the box. If I multiply the matrix in a own function, 
I don't have this problem.


best regards,
jordi




En/na Satish Balay ha escrit:
> If you don't get any output with -trdump - it could mean that all
> objects are getting properly destroyed. But the swap usage is a bit
> unusual.
> 
> You could try the option -trmalloc_log to see how memory is allocate
> on the PETSc side. And also -log_summary to see the summary of memory
> usage.
> 
> Also - is it possible you have malloc() calls in your side of the code
> - that could be leaking memory?
> 
> you could also comment out all MatSetOption() calls and see if it
> makes a difference.
> 
> BTW: 2.2.0 is a very old version. You might want to upgrade to the
> latest 2.3.1
> 
> Satish
> 
> On Mon, 8 May 2006, Jordi Marcé Nogué wrote:
> 
> 
>>Thanks Barry, 
>> 
>>I'm using petsc 2.2.0. When I run my program ( " ./myprogram -trdump " or with 
>>-trmalloc, -trinfo...) I don't obtain anything... in the screen the code doesn't
>>print 
>>anything. 
>> 
>>If I use (for example) "./myprogram -start_on_debugger", in my screen apers gdb
>>
>>and runs good... and with another options like -log_trace petsc writes messages
>>in 
>>my screen. Would I have to activate something in my internal petsc code? 
>> 
>>best regards, 
>>jordi 
>> 
>> 
>> 
>> 
>> 
>> 
>>Missatge citat per Barry Smith <bsmith at mcs.anl.gov>: 
>> 
>>
>>> 
>>>    See 
>>>
>>
>>http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html 
>>
>>>number 12 
>>> 
>>>    You can run for say a few iterations with the options 
>>>-malloc_debug -malloc_dump (in  PETSc 2.3.1. in early releases it had 
>>>different names). At PetscFinalize() PETSc will print all the memory 
>>>it has allocated that has not been freed and where it was allocated. 
>>>This can help determine what objects are not being freed. 
>>> 
>>>    Barry 
>>> 
>>>
>>>>Hi, 
>>>>
>>>>I use PETSc, and after 5000 (more or less) iteations in which i solve a 
>>>
>>>little 
>>>
>>>>matrix 
>>>>(30x30) my swap is totally used!!! I'm sure that when I create my matrices 
>>>
>>>I 
>>>
>>>>destroy 
>>>>them. Could you help me about it? What happens? What thing I do bad? 
>>>>
>>>>Mat K 
>>>>MatCreateSeqAIJ(PETSC_COMM_SELF, dim, dim, 9 , PETSC_NULL, &K); 
>>>>MatSetFromOptions(K); 
>>>>MatSetOption(K, MAT_SYMMETRIC); 
>>>>MatSetOption(K, MAT_ROW_ORIENTED); 
>>>>MatSetOption(K, MAT_IGNORE_ZERO_ENTRIES); 
>>>>MatSetOption(K, MAT_NEW_NONZERO_ALLOCATION_ERR); 
>>>>
>>>>( I use KSP solve, created and destroyed) 
>>>>
>>>>MatDestroy(K); 
>>>>
>>>>
>>>>Thanks, 
>>>>jordi 
>>>>----------- 
>>>>Jordi Marcé-Nogué 
>>>>Dept. Resistència de Materials i Estructures a l'Enginyeria 
>>>>Universitat Politècnica de Catalunya (UPC) 
>>>>
>>>>Edifici T45 - despatx 137 
>>>>ETSEIAT (Terrassa) 
>>>>
>>>>phone: +34 937 398 728 
>>>>mail: jordi.marce at upc.edu 
>>>>
>>>>
>>>>
>>
>> 
>> 
>>  
>>


-- 
Jordi Marcé-Nogué
Dept. Resistència de Materials i Estructures a l'Enginyeria
Universitat Politècnica de Catalunya (UPC)

Edifici T45 - despatx 137
ETSEIAT (Terrassa)

phone: +34 937 398 728
mail: jordi.marce at upc.edu




More information about the petsc-users mailing list