nextsimhub / nextsimdg

neXtSIM_DG : next generation sea-ice model with DG
https://nextsim-dg.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
10 stars 13 forks source link

Issue716 memory leaks in dynamics #722

Closed Thanduriel closed 1 week ago

Thanduriel commented 1 month ago

memory leaks in dynamics

Fixes #716

Change Description

With #674 integrated, all dynamic buffers held by modules should get freed before the program terminates. This update replaces raw pointers with std::unique_ptr for heap buffers that are used internally by the dynamics.

Test Description

A manual test was done by running the dynamics benchmark for 1 time step with valgrind:

==74249== LEAK SUMMARY:
==74249==    definitely lost: 0 bytes in 0 blocks
==74249==    indirectly lost: 0 bytes in 0 blocks
==74249==      possibly lost: 7,600 bytes in 19 blocks
==74249==    still reachable: 110,406 bytes in 717 blocks
==74249==         suppressed: 0 bytes in 0 blocks

The setup that was used is not suited for an automated test as it is takes too long (init + 1 step on 32x32 grid takes upwards of 30mins).

timspainNERSC commented 3 weeks ago

After our shenanigans with develop and having a working integration test, I'm afraid this branch needs rebasing.

Thanduriel commented 1 week ago

This one was a little more tricky than a rebase. I'd appreciate if we could merge this in short order now, it is just a few lines after all.