On Mon, Dec 26, 2011 at 8:34 AM, Dominik Szczerba <dominik at itis.ethz.ch>wrote:
> On Sun, Dec 25, 2011 at 5:19 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote: > > On Sun, Dec 25, 2011 at 10:17, Dominik Szczerba <dominik at itis.ethz.ch> > > wrote: > >> > >> If I call a Create (or Duplicate) function on a non-Destroyed object, > >> will be it destroyed automatically before the new allocation, or is a > >> memory leak expected? > > > > > > What do you mean? Show the function call you are talking about? > > As simple as: > > Vec x > VecCreate... > VecCreate... > exit application > > I would expect a leak to occur, as Matt confirmed, but was surprised > that valgrind was not reporting any issues with this code, and that's > why I asked my question. > With valgrind option --leak-check=full (option not listed in FAQ) lost > memory is reported in the first call to VecCreate, but no issue is > reported due to the lack of VecDestroy. Does Petsc finalize function > do some type of garbage collection? > No, you will see it using -malloc_dump. Valgrind should show you overwriting the pointer. Matt > Thanks > Dominik > -- 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/20111226/9e81f166/attachment.htm>
