@@ -336,10 +336,6 @@ def _test_figure_leak():
336
336
if len (sys .argv ) >= 2 : # Second argument is json-encoded rcParams.
337
337
rcParams .update (json .loads (sys .argv [1 ]))
338
338
339
- # We can't yet directly identify the leak
340
- # so test with a memory growth threshold
341
- ACCEPTABLE_MEMORY_LEAKAGE = 1_000_000
342
-
343
339
# Warmup cycle, this reasonably allocates a lot
344
340
p = psutil .Process ()
345
341
fig = plt .figure ()
@@ -351,14 +347,23 @@ def _test_figure_leak():
351
347
fig = plt .figure ()
352
348
plt .close (fig )
353
349
growth = p .memory_full_info ().uss - mem
354
- assert growth < ACCEPTABLE_MEMORY_LEAKAGE , "Memory leakage too high"
350
+
351
+ print (growth )
355
352
356
353
357
354
@pytest .mark .parametrize ("env" , _get_testable_interactive_backends ())
358
355
def test_figure_leak_20490 (env ):
359
356
pytest .importorskip ("psutil" , reason = "psutil needed to run this test" )
360
- subprocess .run (
357
+
358
+ # We can't yet directly identify the leak
359
+ # so test with a memory growth threshold
360
+ acceptable_memory_leakage = 1_000_000
361
+
362
+ result = subprocess .run (
361
363
[sys .executable , "-c" ,
362
364
inspect .getsource (_test_figure_leak ) + "\n _test_figure_leak()" ],
363
365
env = {** os .environ , "SOURCE_DATE_EPOCH" : "0" , ** env },
364
- timeout = _test_timeout , check = True ,)
366
+ timeout = _test_timeout , stdout = subprocess .PIPE , check = True )
367
+
368
+ growth = int (result .stdout )
369
+ assert growth <= acceptable_memory_leakage
0 commit comments