Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-fix-memory-leaks' into release-v8.1.0 (PR #1160)
This merge fixes memory leaks due to duplicate allocate calls on pointers in the file structs_and_variables.inc. This file is auto-generated and then included by, e.g., src/core_atmosphere/mpas_atm_core_interface.F at compile time. No functional changes are introduced by this merge. For example, in the auto-generated file src/core_atmosphere/inc/structs_and_variables.inc, there are code snippets similar to the following: subroutine atm_generate_pool_mesh(block, structPool, dimensionPool, packagePool) ! ... (Unrelated lines omitted) ... type(mpas_pool_type), pointer :: newSubPool ! ... (Unrelated lines omitted) ... allocate(newSubPool) call mpas_pool_create_pool(newSubPool) call mpas_pool_add_subpool(structPool, 'mesh', newSubPool) call mpas_pool_add_subpool(block % allStructs, 'mesh', newSubPool) ! ... (Unrelated lines omitted) ... end subroutine atm_generate_pool_mesh The problem is that the mpas_pool_create_pool subroutine already allocates the pointer in its arguments internally. Therefore, calling allocate before mpas_pool_create_pool actually causes memory leaks. The fix adopted in this merge is to simply remove the generation of the 'allocate' calls in the 'structs_and_variables.inc' file for each core.
- Loading branch information