From 95dff63ca0f9c2d25816848edec93ef8b274f5e2 Mon Sep 17 00:00:00 2001 From: Pierre Glaser Date: Mon, 27 Jan 2020 15:48:37 +0100 Subject: [PATCH 1/2] FIX increase the threshold of memory-leak tests --- tests/cloudpickle_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py index 8bd210abe..9ca74a430 100644 --- a/tests/cloudpickle_test.py +++ b/tests/cloudpickle_test.py @@ -1533,7 +1533,13 @@ def process_data(): # grown by more than a few MB as closures are garbage collected at # the end of each remote function call. growth = w.memsize() - reference_size - assert growth < 1e7, growth + + # Note that an "empty" Python interpreter on MacOS uses a + # significantly bigger amount of memory than on Linux systems + # (~10MB vs ~1MB), so the upper-bound on the memory use growth used + # below is only tight on Mac, and could be largely reduced on + # Linux. + assert growth < 1.5e7, growth """.format(protocol=self.protocol) assert_run_python_script(code) From 460473c7af879473c244ada320017a41edc28052 Mon Sep 17 00:00:00 2001 From: Pierre Glaser Date: Wed, 29 Jan 2020 23:14:08 +0100 Subject: [PATCH 2/2] correct the inline comment --- tests/cloudpickle_test.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py index 9ca74a430..2dca8abf0 100644 --- a/tests/cloudpickle_test.py +++ b/tests/cloudpickle_test.py @@ -1534,11 +1534,14 @@ def process_data(): # the end of each remote function call. growth = w.memsize() - reference_size - # Note that an "empty" Python interpreter on MacOS uses a - # significantly bigger amount of memory than on Linux systems - # (~10MB vs ~1MB), so the upper-bound on the memory use growth used - # below is only tight on Mac, and could be largely reduced on - # Linux. + # For some reason, the memory growth after processing 100MB of + # data is ~10MB on MacOS, and ~1MB on Linux, so the upper bound on + # memory growth we use is only tight for MacOS. However, + # - 10MB is still 10x lower than the expected memory growth in case + # of a leak (which would be the total size of the processed data, + # 100MB) + # - the memory usage growth does not increase if using 10000 + # iterations instead of 100 as used now (100x more data) assert growth < 1.5e7, growth """.format(protocol=self.protocol)