Skip to content
Snippets Groups Projects
Commit a3efb6a4 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 01/09/2023: IO: bugfix: fix a memory leak for Z-split files

(cherry picked from commit a7413073)
parent 0dad8b8c
Branches
Tags
1 merge request!4Jean Wurtz 30/04/2025 : Bugfixes mainly for TEB and for simple precision
...@@ -590,6 +590,7 @@ SELECT CASE(TPFILE%CTYPE) ...@@ -590,6 +590,7 @@ SELECT CASE(TPFILE%CTYPE)
#ifdef MNH_IOCDF4 #ifdef MNH_IOCDF4
!Remark: IO_Coordvar_write_nc4 disabled (for the moment) for Z-split files !Remark: IO_Coordvar_write_nc4 disabled (for the moment) for Z-split files
! because it introduce a serialization due to MPI communications inside the call ! because it introduce a serialization due to MPI communications inside the call
! WARNING: if uncommented, please modify IO_Coordvar_write_nc4 to enable block concerning gdealloc
! !Write coordinates variables in netCDF file ! !Write coordinates variables in netCDF file
! IF (TZFILE_IOZ%CMODE == 'WRITE' .AND. (TZFILE_IOZ%CFORMAT=='NETCDF4' .OR. TZFILE_IOZ%CFORMAT=='LFICDF4')) THEN ! IF (TZFILE_IOZ%CMODE == 'WRITE' .AND. (TZFILE_IOZ%CFORMAT=='NETCDF4' .OR. TZFILE_IOZ%CFORMAT=='LFICDF4')) THEN
! CALL IO_Coordvar_write_nc4(TZFILE_IOZ,HPROGRAM_ORIG=HPROGRAM_ORIG) ! CALL IO_Coordvar_write_nc4(TZFILE_IOZ,HPROGRAM_ORIG=HPROGRAM_ORIG)
......
...@@ -1596,6 +1596,8 @@ call Write_hor_coord1d( tzdim_ni_v, 'x-dimension of the grid at v location', & ...@@ -1596,6 +1596,8 @@ call Write_hor_coord1d( tzdim_ni_v, 'x-dimension of the grid at v location', &
call Write_hor_coord1d( tzdim_nj_v, 'y-dimension of the grid at v location', & call Write_hor_coord1d( tzdim_nj_v, 'y-dimension of the grid at v location', &
trim(ystdnameprefix)//'_y_coordinate_at_v_location', 'Y', -0.5, jphext, 0, zyhat_glob ) trim(ystdnameprefix)//'_y_coordinate_at_v_location', 'Y', -0.5, jphext, 0, zyhat_glob )
!Warning: the following block has to be reenabled if IO_Coordvar_write_nc4 is again called for Z-split files
#if 0
!The z?hat*_glob were allocated in Gather_hor_coord1d calls !The z?hat*_glob were allocated in Gather_hor_coord1d calls
!Deallocate only if it is a non Z-split file or the last Z-split subfile !Deallocate only if it is a non Z-split file or the last Z-split subfile
gdealloc = .false. gdealloc = .false.
...@@ -1604,6 +1606,9 @@ if ( Associated( tpfile%tmainfile ) ) then ...@@ -1604,6 +1606,9 @@ if ( Associated( tpfile%tmainfile ) ) then
else if ( tpfile%nsubfiles_ioz == 0 .and. .not. Associated( tpfile%tmainfile ) ) then else if ( tpfile%nsubfiles_ioz == 0 .and. .not. Associated( tpfile%tmainfile ) ) then
gdealloc = .true. gdealloc = .true.
end if end if
#else
gdealloc = .true.
#endif
if ( .not. lcartesian ) then if ( .not. lcartesian ) then
!Compute latitude/longitude for the Arakawa points !Compute latitude/longitude for the Arakawa points
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment