New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#1942 (Memory leak in timing code, incomplete fix) – NEMO

Opened 6 years ago

Closed 6 years ago

#1942 closed Bug (fixed)

Memory leak in timing code, incomplete fix

Reported by: mdunphy Owned by: francesca
Priority: low Milestone: 2017 WP
Component: OCE Version: v3.6
Severity: minor Keywords:
Cc:

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 mdunphy 6 years ago.
Patch to fix three minor memory leaks in timing.F90

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by mdunphy

Patch to fix three minor memory leaks in timing.F90

comment:1 Changed 6 years 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 6 years 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 6 years ago by clevy

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

comment:4 Changed 6 years ago by mocavero

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

comment:5 Changed 6 years ago by francesca

In 9214:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:6 Changed 6 years ago by francesca

In 9215:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:7 Changed 6 years 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.