Skip to content

Commit

Permalink
llvm: Disable leak checks on Pypy
Browse files Browse the repository at this point in the history
Pypy's GC is not good enough to cleanup and works with many references.

Signed-off-by: Jan Vesely <[email protected]>
  • Loading branch information
jvesely committed Nov 22, 2024
1 parent cd78000 commit 21dd578
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions psyneulink/core/llvm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import gc
import inspect
import numpy as np
import platform
import time
from math import ceil, log2
from psyneulink._typing import Set
Expand Down Expand Up @@ -283,6 +284,9 @@ def cleanup(check_leaks:bool=False):
if len(c) > 0:
gc.collect()

if platform.python_implementation() == 'PyPy':
return

assert len(c) == 0, list(c)
else:
LLVMBuilderContext.clear_global()
Expand All @@ -297,8 +301,10 @@ def cleanup(check_leaks:bool=False):
c._compilation_data.execution.values.clear()
c._compilation_data.execution.history.clear()

# The set of active executions should be empty
for e in CompExecution.active_executions:
assert any(inspect.isframe(r) for r in gc.get_referrers(e))
if platform.python_implementation() != 'PyPy':

# The set of active executions should be empty
for e in CompExecution.active_executions:
assert any(inspect.isframe(r) for r in gc.get_referrers(e))

CompExecution.active_executions.clear()

0 comments on commit 21dd578

Please sign in to comment.