diff --git a/package/AUTHORS b/package/AUTHORS index ed19d3ac17..83dd5c620e 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -287,7 +287,7 @@ Chronological list of authors - Francesco Siciliani - Akshit Boora - Sumit Saraswat - + - Erik Fransson External code ------------- diff --git a/package/CHANGELOG b/package/CHANGELOG index ed3d37a7fd..1ee57ec083 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -14,11 +14,17 @@ The rules for this file: ------------------------------------------------------------------------------- -??/??/?? IAlibay, sumitsaraswat362 +??/??/?? IAlibay, sumitsaraswat362, erikfransson * 2.12.0 Fixes + * The NCDF reader now releases the pages of the memory map once a frame has + been read into the Timestep. Reading a netCDF trajectory with `mmap=True` + (the default for a file name) no longer grows the resident memory of the + process towards the size of the whole trajectory file. Requires a platform + that provides `MADV_DONTNEED`, i.e. not Windows (Discussion #4792, + PR #5463). Enhancements * InterRDF and InterRDF_s now expose computed average box volume and densities diff --git a/package/MDAnalysis/coordinates/TRJ.py b/package/MDAnalysis/coordinates/TRJ.py index e9799e4d94..6687093651 100644 --- a/package/MDAnalysis/coordinates/TRJ.py +++ b/package/MDAnalysis/coordinates/TRJ.py @@ -134,6 +134,7 @@ import warnings import errno import logging +import mmap from math import isclose import MDAnalysis @@ -675,6 +676,10 @@ def _read_frame(self, frame): self.convert_pos_from_native(ts.dimensions[:3]) ts.frame = frame # frame labels are 0-based self._current_frame = frame + # the frame is now copied into ts, so its pages can be dropped again + mm = getattr(self.trjfile, "_mm", None) + if mm is not None and hasattr(mmap, "MADV_DONTNEED"): + mm.madvise(mmap.MADV_DONTNEED) return ts def _reopen(self):