<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hei,</p>
<p>For a project I wanted to combine boost::odeint for timestepping
and PETSc-based vectors and matrices for calculating the right
hand side. As comparison for both timing and correctness I set up
an armadillo-based right hand side (with the main-function being
in <b>main.cpp</b>, and the test code in <b>test_timestepping_clean.cpp</b>)<br>
</p>
<p>In theory, the code works fine, but I have some issues with
cleaning up afterwards in my struct <i>Petsc_RHS_state_clean</i>.
My initial intention was to set up all involved matrices and
vectors within the constructor, and free the memory in the
destructor. To avoid freeing vectors I have not used I initially
set them to <i>PETSC_NULL</i>, and check if this value has been
changed before calling <i>VecDestroy().</i> However, when doing
that I get the following error:</p>
<p><span style="font-family:monospace"><span style="color:#000000;background-color:#ffffff;">[0]PETSC
ERROR:
------------------------------------------------------------------------
</span><br>
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation
Violation, probably memory access out of range
<br>
[0]PETSC ERROR: Try option -start_in_debugger or
-on_error_attach_debugger
<br>
[0]PETSC ERROR: or see <a class="moz-txt-link-freetext" href="https://petsc.org/release/faq/#valgrind">https://petsc.org/release/faq/#valgrind</a>
<br>
[0]PETSC ERROR: or try <a class="moz-txt-link-freetext" href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and
Apple Mac OS X to find memory corruption errors
<br>
[0]PETSC ERROR: configure using --with-debugging=yes, recompile,
link, and run <br>
[0]PETSC ERROR: to get more information on the crash.
<br>
<span style="font-weight:bold;color:#ff5454;background-color:#ffffff;">[0]PETSC
ERROR: --------------------- Error Message
--------------------------------------------------------------</span></span></p>
<p>If I comment out that code in ~Petsc_RHS_state_clean(), the
program runs, but will use ~17 GByte of RAM during runtime. As the
memory is not used immediately in full, but rather increases
during running, I assume a memory leak somewhere. Where does it
come from, and how can I avoid it?</p>
<p>Thanks!</p>
<p>Regards,</p>
<p>Roland Richter<br>
</p>
<p><span style="font-family:monospace"></span></p>
</body>
</html>