[petsc-users] How to use petsc in a dynamically loaded shared library?

Jed Brown jedbrown at mcs.anl.gov
Thu Jul 19 06:36:36 CDT 2012


On Thu, Jul 19, 2012 at 2:40 AM, Florian Beck <Flo.44 at gmx.de> wrote:

> In the debugger is the adress of my vector at the beginning and the end
> the same, but if I look inside the vector the adress of ops, map and data
> are 0x0 after I call the function VecDuplicate(). Is there a function to
> synchronize the vectors before I destroy them?


Sounds like a reference-counting bug. The most common cause is basically

Vec X,Y;
VecCreate(comm,&X);
...
Y = X;
...
VecDestroy(&X);
VecDestroy(&Y);

(perhaps spread across multiple functions, and perhaps with a reference
obtained through a function that does not give you an "ownership share" by
incrementing reference count).

You can use "watch -l X->hdr.refct" in recent gdb to follow all the
locations where reference count was changed (this includes the library), if
you need a heavyweight methodology for tracking down the error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120719/eaf580d3/attachment-0001.html>


More information about the petsc-users mailing list