Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix memory leak relate allocate array again before deallocate call
TYPE: bug fix,
KEYWORDS: Memory Leak
SOURCE: Charlie Li - Software developer from lakes environmental canada
DESCRIPTION OF CHANGES:
Problem:
the change in wrf_timeseries.F and start_em.F are memory leak detected when use PGI option:
-g -O0 -traceback -Mchkptr -Mbounds -Ktrap=fp -Msave -tp=px
It will failed for: "0: ALLOCATE: array already allocated"
ALLOCATE(dz8w(IMS:IME,KMS:KME,JMS:JME),STAT=I) ; dz8w = 0.
miss logic to deallocate dz8w
2../share/wrf_timeseries.F
SUBROUTINE calc_ts( grid )
#if ( EM_CORE == 1 )
PRINT *, "ALLOCATE WILL call in wrf_timeseries.F at line 356: ALLOCATE ( earth_u_profile(grid%max_ts_level), earth_v_profile(grid%max_ts_level) )"
ALLOCATE ( earth_u_profile(grid%max_ts_level), earth_v_profile(grid%max_ts_level) )
PRINT *, "ALLOCATE called in wrf_timeseries.F at line 356: ALLOCATE ( earth_u_profile(grid%max_ts_level), earth_v_profile(grid%max_ts_level) )"
#endif
IF ( grid%ntsloc_domain .LE. 0 ) RETURN
#if ((EM_CORE == 1) && (DA_CORE != 1))
IF ( grid%dfi_opt /= DFI_NODFI .AND. grid%dfi_stage /= DFI_FST ) RETURN
#endif
when it return, it didn't free memory for earth_u_profile and earth_v_profile if EM_CORE == 1
Solution:
Just in source code add code to free memory related
ISSUE: For use when this PR closes an issue.
Fixes #123
LIST OF MODIFIED FILES: list of changed files (use
git diff --name-status master
to get formatted list)share/wrf_timeseries.F
dyn_em/start_em.F
TESTS CONDUCTED:
RELEASE NOTE: Include a stand-alone message suitable for the inclusion in the minor and annual releases. A publication citation is appropriate.