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

zakaryah . zakaryah at gmail.com
Wed Mar 7 15:39:46 CST 2018


Your description is really vague and I doubt this has anything to do with
PETSc.

Did you recompile before executing the second test?

Have you stepped through with gdb or other debugger, and have you run with
valgrind?

If so, one thing to be extra careful about - do you have anything in global
or stack arrays, for example, an array declared in your function like
"float array[16];"?  Valgrind won't check bounds for those arrays - there
are other tools which do.  Anyway, it sounds like you have a bug but it's
hard to tell because I don't know what you are trying to do.


On Wed, Mar 7, 2018 at 4:13 PM, Ali Berk Kahraman <aliberkkahraman at yahoo.com
> wrote:

> 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
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180307/b2b39bcb/attachment.html>


More information about the petsc-users mailing list