Potential memory leak

18 views
Skip to first unread message

Ersan DEMIRER

unread,
Mar 17, 2023, 6:48:57 AM3/17/23
to pflotran-dev
Hello,

I believe there is a memory leak in the THAccumDerivative subroutine located in th.F90

When using a numerical jacobian, the perturbated globalauxvar does get stripped but not the perturbed materialauxvar

Adding call MaterialAuxVarStrip(material_auxvar_pert) at the end of the subroutine solved the problem for me (checked with valgrind).

Without the fix after 10 steps on a simple dummy problem with 10 volumes:

==101950== LEAK SUMMARY:
==101950==    definitely lost: 3,432 bytes in 115 blocks
==101950==    indirectly lost: 448 bytes in 7 blocks
==101950==      possibly lost: 0 bytes in 0 blocks
==101950==    still reachable: 0 bytes in 0 blocks
==101950==         suppressed: 0 bytes in 0 blocks

With the fix:

==100796== LEAK SUMMARY:
==100796==    definitely lost: 792 bytes in 5 blocks
==100796==    indirectly lost: 448 bytes in 7 blocks
==100796==      possibly lost: 0 bytes in 0 blocks
==100796==    still reachable: 0 bytes in 0 blocks
==100796==         suppressed: 0 bytes in 0 blocks

Best,

Ersan
Reply all
Reply to author
Forward
0 new messages