Hello,

Am Montag, 13. Juli 2015, 12:26:21 schrieb Barry Smith:
> 
>   Run under valgrind first, see if it gives any more details about the memory 
> issue http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind

I tried running it like that:

valgrind --tool=memcheck ./pmpi A -malloc off 

(pmpi is my application, no mpirun)

but it reported no errors at all.
 
>   Can you send the code that produces this problem?

I was not able to isolate that problem, you can of course have a look at our 
application:

git clone [email protected]:precice/precice.git
MPI_CXX="clang++" scons -j 4 boost_inst=on python=off petsc=on mpi=on 
compiler=mpic++ build=debug

The test client:
git clone [email protected]:floli/prempi.git
you need to adapt line 5 in SConstruct: preciceRoot
scons

Take one terminal run ./pmpi A, another to run ./pmpi B

Thanks for taking a look! Mail me if any problem with the build occurs.

Florian

> 
> > On Jul 13, 2015, at 10:56 AM, Florian Lindner <[email protected]> wrote:
> > 
> > Hello,
> > 
> > our petsc application suffers from a memory error (double free or 
> > corruption).
> > 
> > Situation is a like that:
> > 
> > A KSP is private member of a C++ class. In its constructor I call 
> > KSPCreate. Inbetween it may haben that I call KSPREset. In the class' 
> > destructor I call KSPDestroy. That's where the memory error appears:
> > 
> > gdb backtrace:
> > 
> > 
> > #4  0x00007ffff490b8db in _int_free () from /usr/lib/libc.so.6
> > #5  0x00007ffff6188c9c in PetscFreeAlign (ptr=0xfcd990, line=258, 
> > func=0x7ffff753c4c8 <__func__.20304> "KSPReset_GMRES", file=0x7ffff753b8b0 
> > "/home/florian/software/petsc/src/ksp/ksp/impls/gmres/gmres.c")
> >    at /home/florian/software/petsc/src/sys/memory/mal.c:72
> > #6  0x00007ffff6ff6cdc in KSPReset_GMRES (ksp=0xf48470) at 
> > /home/florian/software/petsc/src/ksp/ksp/impls/gmres/gmres.c:258
> > #7  0x00007ffff70ad804 in KSPReset (ksp=0xf48470) at 
> > /home/florian/software/petsc/src/ksp/ksp/interface/itfunc.c:885
> > #8  0x00007ffff70ae2e8 in KSPDestroy (ksp=0xeb89d8) at 
> > /home/florian/software/petsc/src/ksp/ksp/interface/itfunc.c:933
> > 
> > #9  0x0000000000599b24 in 
> > precice::mapping::PetRadialBasisFctMapping<precice::mapping::Gaussian>::~PetRadialBasisFctMapping
> >  (this=0xeb8960) at src/mapping/PetRadialBasisFctMapping.hpp:148
> > #10 0x0000000000599bc9 in 
> > precice::mapping::PetRadialBasisFctMapping<precice::mapping::Gaussian>::~PetRadialBasisFctMapping
> >  (this=0xeb8960) at src/mapping/PetRadialBasisFctMapping.hpp:146
> > 
> > Complete backtrace at http://pastebin.com/ASjibeNF
> > 
> > 
> > Could it be a problem it objects set by KSPSetOperators are destroyed 
> > afterwards? I don't think so, since KSPReset is called before.
> > 
> > I've wrapped a class (just a bunch of helper function, no encapsulating 
> > wrapper) round Mat and Vec objects. Nothing fancy, the ctor calls 
> > MatCreate, the dtor MatDestroy, you can have a look at 
> > https://github.com/precice/precice/blob/develop/src/mapping/petnum.cpp / 
> > .hpp.
> > 
> > These objects are also members of the same class like KSP, so their dtor is 
> > called after KSPDestroy.
> > 
> > What could cause the memory corruption here?
> > 
> > Thanks a lot,
> > Florian
> 

Reply via email to