Skip to content

Commit 43953f9

Browse files
authored
Merge branch 'main' into remove_dict
2 parents 46d1e34 + e32892c commit 43953f9

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ class DeviceMemoryResourceAttributes:
583583
# This enables buffer serialization, as buffers can reduce to a pair
584584
# of comprising the memory resource UUID (the key into this registry)
585585
# and the serialized buffer descriptor.
586-
_ipc_registry = {}
586+
cdef object _ipc_registry = weakref.WeakValueDictionary()
587587

588588

589589
cdef class DeviceMemoryResource(MemoryResource):
@@ -756,8 +756,6 @@ cdef class DeviceMemoryResource(MemoryResource):
756756
with nogil:
757757
HANDLE_RETURN(cydriver.cuMemPoolDestroy(self._mempool_handle))
758758
finally:
759-
if self.is_mapped:
760-
self.unregister()
761759
self._dev_id = cydriver.CU_DEVICE_INVALID
762760
self._mempool_handle = NULL
763761
self._attributes = None
@@ -803,13 +801,6 @@ cdef class DeviceMemoryResource(MemoryResource):
803801
self._uuid = uuid
804802
return self
805803

806-
def unregister(self):
807-
"""Unregister this mapped memory resource."""
808-
assert self.is_mapped
809-
if _ipc_registry is not None: # can occur during shutdown catastrophe
810-
with contextlib.suppress(KeyError):
811-
del _ipc_registry[self.uuid]
812-
813804
@property
814805
def uuid(self) -> Optional[uuid.UUID]:
815806
"""

0 commit comments

Comments
 (0)