Add deallocation/clean methods and structure
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
We've been sloppy about memory management in CTSM, so we don't often have subroutines or methods that deallocate our memory. In many cases this is because many data objects are permanent and stay allocated through the life of the simulation.
There are three types of problems with this though:
- It makes it more likely that opportunities when memory could be cleaned up earlier aren't taken advantage of
- It makes it harder to find memory leaks
- It makes it harder to do unit tests around code without clean methods
For the second one If you have clean methods and they are called at model finalization, you check for what memory is still allocated at that point. And you can do code inspection things like check that all allocates have a matching deallocate and that the deallocate clean methods are called at the appropriate times
This is a long term code health type thing that isn't a priority now. But, starting to add the structure for this type of thing would be good to have in place so that we can at least bring it in for new code that comes into the model.
Contributor guide
Assessment
This issue has not been assessed yet.