[petsc-users] segmentation error

Jed Brown jed at jedbrown.org
Sun Jan 25 08:10:48 CST 2015


Dave May <dave.mayhem23 at gmail.com> writes:

> This type of bizarre unexplainable behaviour usually indicates memory
> corruption.
> For example: an illegal read of write from an array.
> I suggest you run your code through valgrind to rule this out.
>
> Also, I would recommend you modify and annotate your functions to enable
> petsc to generate a stack trace when segv's occur, i.e., declare them like
> this
>
> #undef __FUNCT__
> #define __FUNCT__ "MyFunction"
> PetscErrorCode MyFunction(void)
> {

I agree with everything Dave says, but put the following before the
first statement in the function.

  PetscFunctionBeginUser;

>     PetscFunctionReturn(0);
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150125/3d049168/attachment.pgp>


More information about the petsc-users mailing list