Potential Causes of Memory Leaks #558
-
I have a simulation I am running that appears to use more memory as the simulation progresses. While the simulation does use AMR, I have checked and the number of MeshBlocks stays the same so memory usage should not be increasing with time. I wanted to check to make sure I am following Athena++ best practices in case I have introduced a memory leak into the system somewhere. While the custom pgen for this simulation is quite extensive, I have tried to keep to the general Athena++ formalism. I have not attempted to make any allocations directly to heap; all variables exist on the stack or are generated via the NewAthenaArray constructor. If I create an array using this method, am I correct in saying it should automatically be deallocated when it leaves scope, or do I need to manually free this memory? A code snippet for example:
From a quick scan of the AthenaArray definition I think If there are any other obvious potential memory leak sources specific to Athena++ that I should be aware of please let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
It is deallocated automatically when it leaves scope here |
Beta Was this translation helpful? Give feedback.
-
How significant is the growth in memory? |
Beta Was this translation helpful? Give feedback.
-
Does this happen with a single MPI rank and single thread? If it does, it might be worth running the executable through |
Beta Was this translation helpful? Give feedback.
-
Memory gain is present for standard test simulations (e.g. orszag-tang) on a clean, updated install of Athena++. I expect this means I have some issues with my compiler/MPI libraries, I will contact my cluster admin to see if I can close this issue. |
Beta Was this translation helpful? Give feedback.
Issue is now resolved. It appears there was some issue with how the cluster libraries were compiled, rather than any specific interaction with Athena++. Marking this issue as answered, thanks all for the advice.