#1942 closed Bug (fixed)

Memory leak in timing code, incomplete fix

Reported by:mdunphy Component: OCE
Version: release-3.6 Severity: minor
Keywords: Cc:
Owned by:francesca Milestone: 2017 WP
Priority: low



With timing enabled, we've found that the code gradually leaks memory and eventually gets terminated due to excessive memory usage

Could be related to #1600. Not the same as #1902 or #1836 because AGRIF was not enabled here, but solving this might also solve the AGRIF-on case.


I ran valgrind on NEMO with timing enabled in an attempt to track it down, which flagged a few minor leaks — a few dozen bytes lost once — but it did not flag any major leaks that grow each time step.

Partial Fix

Attached is a patch for the minor leaks.
This is not a complete fix because the leak persists after applying the patch.

Commit History (2)


fix ticket #1942 in dev_merge_2017


fix ticket #1942 in nemo_v3_6_STABLE

Attachments (1)

timing_memleak_fix.patch (1.3 KB) - added by mdunphy 16 months ago.
Patch to fix three minor memory leaks in timing.F90

Download all attachments as: .zip

Change History (8)

Changed 16 months ago by mdunphy

Patch to fix three minor memory leaks in timing.F90

comment:1 Changed 16 months ago by dupontf

I agree with the changes. A new pointer needs only to point. The allocation beforehand will only create a space that is going to be lost afterwards. And during de-allacation of a fortran type structure, it is best practice to deallocate all members first.

comment:2 Changed 16 months ago by mocavero

What revision of the 3.6 stable version has been used for this tests? Which configuration? The analysis performed for #1600 reported no major leaks on NEMO3.6 stable rev. 7654, while an old revision (6287) of the NEMO3.6 stable showed the presence of major memory leaks when XIOS1 was used in attached mode (see ticket #1600).

comment:3 Changed 16 months ago by clevy

  • Owner set to mocavero
  • Status changed from new to assigned

comment:4 Changed 12 months ago by mocavero

  • Owner changed from mocavero to francesca
  • Severity set to minor

comment:5 Changed 12 months ago by francesca

In 9214:

fix ticket #1942 in nemo_v3_6_STABLE

Code review status: pending

comment:6 Changed 12 months ago by francesca

In 9215:

fix ticket #1942 in dev_merge_2017

Code review status: pending

comment:7 Changed 12 months ago by francesca

  • Resolution set to fixed
  • Status changed from assigned to closed

Add patch to solve three minor memory leaks in timing.F90

Note: See TracTickets for help on using tickets.