Opened 10 years ago

Closed 9 years ago

#58 closed Defect (fixed)

Memory leak in netcdf ouput routine

Reported by: adingwell Owned by: jbrioude
Priority: minor Milestone: FLEXPART_WRF_3.2_FPbase_9
Component: FP other Version: FLEXPART-WRF
Keywords: Cc: rstow

Description

The files created by write_ncconc.f90 aren't closed unless the maximum number of records per file is reached. This leads to a lot of memory being wasted when making repeated runs (without any external means of cleaning out dead memory).

It can be fixed by putting the following lines at the end of write_ncconc.f90:

  if ( jul .ge. edate ) then
    write(*,*) "write_ncconc: End of simulation reached, closing output file"
    ncret=nf_close(ncid)
    call check_ncerror(ncret)
  endif

Change History (4)

comment:1 Changed 10 years ago by DefaultCC Plugin

  • Cc rstow added

comment:2 Changed 10 years ago by jbrioude

  • Owner changed from somebody to jbrioude
  • Status changed from new to accepted

Hi Adam,
Thanks for the fix.
If we put those lines at the end of write_ncconc.f90 and flexpart-wrf finishes a run without writing something before, it won't close the file.
Don't you think that it's better to put those lines (and use the shared variable ncout in com_mod.f90) at the end of timemanager.f, just before flexpart stops?

I'm working on a new version of flexpart-wrf. Beside your fix, some problems have been found when someone wants to use a warm start in flexpart-wrf when ascii and netcdf output format are asked. I'm testing the new version.

comment:3 Changed 10 years ago by pesei

  • Milestone set to FLEXPART_WRF_3.2_FPbase_9

comment:4 Changed 9 years ago by jbrioude

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.
hosted by ZAMG