Opened 5 months ago

Closed 6 weeks ago

#1942 closed Bug (fixed)

Memory leak in timing code, incomplete fix

Reported by:Michael Component: OPA
Version: release-3.6 Severity: minor
Keywords: Cc:
Management
Owned by:Francesca Mele Milestone: 2017 WP
Priority: low

Description

Context

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.

Analysis

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)

ChangesetAuthorTimeChangeLog
9215francesca2018-01-12T12:25:59+01:00

fix ticket #1942 in dev_merge_2017

9214francesca2018-01-12T12:23:19+01:00

fix ticket #1942 in nemo_v3_6_STABLE

Attachments (1)

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

Download all attachments as: .zip

Change History (8)

Changed 5 months ago by Michael

Patch to fix three minor memory leaks in timing.F90

comment:1 Changed 5 months ago by Frederic Dupont

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 5 months ago by Silvia 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 5 months ago by Claire Levy

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

comment:4 Changed 6 weeks ago by Silvia Mocavero

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

comment:5 Changed 6 weeks ago by Francesca Mele

In 9214:

fix ticket #1942 in nemo_v3_6_STABLE

Code review status: pending

comment:6 Changed 6 weeks ago by Francesca Mele

In 9215:

fix ticket #1942 in dev_merge_2017

Code review status: pending

comment:7 Changed 6 weeks ago by Francesca Mele

  • 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.