[petsc-users] Leaking Memory From the Future????

Ali Berk Kahraman aliberkkahraman at yahoo.com
Wed Mar 7 15:13:44 CST 2018


Dear All,

I am in an impossible position. My real code is long, so I will briefly 
describe my situation.

I call 2 functions that I have written in my code, it goes like

Function1(Do stuff with MatGetValues and MatSetValues);
Visualize the Result of Function1 with MatView;
Function2(Do stuff with MatGetValues and MatSetValues);

The result I get in this situation is wrong, because I know the correct 
result. Function 1 reaches rows of the matrix that it should not. But 
here is where it gets interesting. If I do not call Function2 at all, 
namely do the following,

Function1(Do stuff with MatGetValues and MatSetValues);
Visualize the Result of Function1 with MatView;
/* Function2(Do stuff with MatGetValues and MatSetValues); */

Here, the result I see from Function 1 is correct and different from the 
result of the first case. But, for my simulation to work, I must call 
Function2. I have been dealing with this for the whole day, and I still 
have no idea how this happens. The code sees the next line and changes 
the result of the previous line.

Any ideas? Anything similar to this in the literature?

Best Regards to All,

Ali Berk Kahraman
M.Sc. Student, Bogazici Uni.
Istanbul, Turkey







More information about the petsc-users mailing list