<p dir="ltr">Thanks a lot Dave and Jed! That helped :)</p>
<div class="gmail_quote">On Jan 25, 2015 7:40 PM, "Jed Brown" <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dave May <<a href="mailto:dave.mayhem23@gmail.com">dave.mayhem23@gmail.com</a>> writes:<br>
<br>
> This type of bizarre unexplainable behaviour usually indicates memory<br>
> corruption.<br>
> For example: an illegal read of write from an array.<br>
> I suggest you run your code through valgrind to rule this out.<br>
><br>
> Also, I would recommend you modify and annotate your functions to enable<br>
> petsc to generate a stack trace when segv's occur, i.e., declare them like<br>
> this<br>
><br>
> #undef __FUNCT__<br>
> #define __FUNCT__ "MyFunction"<br>
> PetscErrorCode MyFunction(void)<br>
> {<br>
<br>
I agree with everything Dave says, but put the following before the<br>
first statement in the function.<br>
<br>
PetscFunctionBeginUser;<br>
<br>
> PetscFunctionReturn(0);<br>
> }<br>
</blockquote></div>