[petsc-users] How to use petsc in a dynamically loaded shared library?
Matthew Knepley
knepley at gmail.com
Fri Jul 20 06:04:55 CDT 2012
On Fri, Jul 20, 2012 at 1:39 AM, Florian Beck <Flo.44 at gmx.de> wrote:
> Hi,
>
>
> 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.
> >
>
> I have looked for the counting bug, but I haven't found anything because
> my gdb crashes.
>
> Is it not possible to restore the addresses ops, map and data? I think
> it's possible to get values and from the vectors, so why shouldn't it
> possible to destroy them? Or is it possible to destroy the Vectors manually?
>
1) This has nothing to do with shared libraries. You have a bug in your
code.
2) Debugging is about making your code simpler until you can find the bug,
and
learning to use debugging tools. This is a big part of programming.
3) Of course, you can destroy Vecs. You have a bug. Try using valgrind.
Matt
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120720/fffb9bec/attachment.html>
More information about the petsc-users
mailing list