Skip to content

Commit

Permalink
Merge pull request #90 from ecmwf-ifs/naan-packed-storage-mem-leak
Browse files Browse the repository at this point in the history
CLOUDSC_FIELD_STATE_MOD: fix device memory leak for packed storage option
  • Loading branch information
reuterbal authored Jun 2, 2024
2 parents 7539f74 + 8c8a691 commit 4fe2119
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions src/common/module/cloudsc_field_state_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,44 +485,35 @@ SUBROUTINE CLOUDSC_FIELD_STATE_FINALIZE(SELF, USE_PACKED)
IF(USE_PACKED)THEN
CALL FIELD_DELETE(SELF%DATA_RDONLY)
CALL FIELD_DELETE(SELF%DATA_RWONLY)

CALL FIELD_DELETE(SELF%F_PLUDE)
CALL FIELD_DELETE(SELF%F_PAPH)
CALL FIELD_DELETE(SELF%F_PLSM)
CALL FIELD_DELETE(SELF%F_LDCUM)
CALL FIELD_DELETE(SELF%F_KTYPE)
CALL FIELD_DELETE(SELF%F_PCLV)
CALL FIELD_DELETE(SELF%F_PCOVPTOT)
CALL FIELD_DELETE(SELF%F_PRAINFRAC_TOPRFZ)
ELSE
DO IFIELD=1,23
CALL FIELD_DELETE(SELF%FIELDS_RDONLY(IFIELD)%PTR)
ENDDO

CALL FIELD_DELETE(SELF%F_PLUDE)
CALL FIELD_DELETE(SELF%F_PAPH)
CALL FIELD_DELETE(SELF%F_PLSM)
CALL FIELD_DELETE(SELF%F_LDCUM)
CALL FIELD_DELETE(SELF%F_KTYPE)
CALL FIELD_DELETE(SELF%F_PCLV)
CALL FIELD_DELETE(SELF%F_PCOVPTOT)
CALL FIELD_DELETE(SELF%F_PRAINFRAC_TOPRFZ)

DO IFIELD=1,14
CALL FIELD_DELETE(SELF%FIELDS_RWONLY(IFIELD)%PTR)
ENDDO

CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_T)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_A)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_Q)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_CLD)

CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_T)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_A)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_Q)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_CLD)
ENDIF

CALL FIELD_DELETE(SELF%F_PLUDE)
CALL FIELD_DELETE(SELF%F_PAPH)
CALL FIELD_DELETE(SELF%F_PLSM)
CALL FIELD_DELETE(SELF%F_LDCUM)
CALL FIELD_DELETE(SELF%F_KTYPE)
CALL FIELD_DELETE(SELF%F_PCLV)
CALL FIELD_DELETE(SELF%F_PCOVPTOT)
CALL FIELD_DELETE(SELF%F_PRAINFRAC_TOPRFZ)

CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_T)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_A)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_Q)
CALL FIELD_DELETE(SELF%TENDENCY_LOC%F_CLD)

CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_T)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_A)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_Q)
CALL FIELD_DELETE(SELF%TENDENCY_TMP%F_CLD)

DEALLOCATE(SELF%FIELDS_RDONLY)
DEALLOCATE(SELF%FIELDS_RWONLY)

Expand Down

0 comments on commit 4fe2119

Please sign in to comment.