fix(Adaptor): Add cleanup function to handle possible memory leak

This commit is contained in:
Karim shoair
2025-07-27 23:31:55 +03:00
parent 6ae1810405
commit ffde7e8ad9
+8
View File
@@ -181,6 +181,14 @@ class Adaptor(SelectorsGeneration):
else {}
)
def __del__(self):
"""Ensure cleanup happens"""
if hasattr(self, "_storage") and self._storage:
try:
self._storage.close()
finally:
self._storage = None
# Node functionalities, I wanted to move to a separate Mixin class, but it had a slight impact on performance
@staticmethod
def _is_text_node(