Skip to content

Commit 0731edd

Browse files
Remove reference cycle within SpatialData to fix memory leak in bounding_box_query (#914)
Remove reference cycle within SpatialData Co-authored-by: LucaMarconato <[email protected]>
1 parent 03de841 commit 0731edd

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/spatialdata/_core/spatialdata.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ def __init__(
178178
self.validate_table_in_spatialdata(v)
179179
self.tables[k] = v
180180

181-
self._query = QueryManager(self)
182-
183181
def validate_table_in_spatialdata(self, table: AnnData) -> None:
184182
"""
185183
Validate the presence of the annotation target of a SpatialData table in the SpatialData object.
@@ -496,7 +494,7 @@ def query(self) -> QueryManager:
496494
spatialdata.bounding_box_query
497495
spatialdata.polygon_query
498496
"""
499-
return self._query
497+
return QueryManager(self)
500498

501499
def aggregate(
502500
self,

0 commit comments

Comments
 (0)