From ee31bc30570750d53bb68f0f0f7f9d8982461c37 Mon Sep 17 00:00:00 2001 From: ljgray Date: Mon, 1 May 2023 15:44:49 -0700 Subject: [PATCH] feat(beamform): delete some class list attributes in 'process_finish'. These lists can hold fairly large chunks of data which will not get cleared from memory otherwise. --- draco/analysis/beamform.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/draco/analysis/beamform.py b/draco/analysis/beamform.py index c9b036e49..1cf0b5feb 100644 --- a/draco/analysis/beamform.py +++ b/draco/analysis/beamform.py @@ -380,6 +380,18 @@ def process(self): return formed_beam + def process_finish(self): + """Clear lists holding copies of data. + + These lists will persist beyond this task being done, so + the data stored there will continue to use memory. + """ + for attr in ["vis", "visweight", "bvec", "sumweight"]: + try: + delattr(self, attr) + except AttributeError: + pass + def _ha_array(self, ra, source_ra_index, source_ra, ha_side, is_sstream=True): """Hour angle for each RA/time bin to be processed.