Release the compiled module on close

close() now clears _module (initialized to None) inside the active
context together with the function references; lifecycle test asserts
it is retained on failed activation and cleared after close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-15 02:59:08 +00:00
1 parent 4645e48a2c
commit 7281d91fd6
2 files changed
+8 -3

No files matched your search

+2 -2
View File
@@ -57,7 +57,7 @@ class PeriodicBlockStepper:
self._status = "new"
self._step_count = 0
self._allocations = []
self._stream = self._copy = self._step = None
self._stream = self._module = self._copy = self._step = None
with self.ctx.activate():
try:
free, _ = cuda.mem_get_info()
@@ -179,7 +179,7 @@ class PeriodicBlockStepper:
self._stream.synchronize()
except Exception as exc:
error = exc
self._copy = self._step = None
self._copy = self._step = self._module = None
for pointer in self._allocations:
try:
pointer.free()