From 7278b55cd4ee9ee454bb901ea508567389afa4cb Mon Sep 17 00:00:00 2001 From: Dsssyc Date: Wed, 31 Dec 2025 10:35:56 +0000 Subject: [PATCH] feat: Update README with recent bug fixes and improvements; bump version to 0.1.9 and enhance resource management in ORM close method --- README.md | 1 + pyproject.toml | 2 +- python/fastdb4py/orm/__init__.py | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c9a93a0..614a5c3 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ A C++ local database library with cross language bindings. Aiming to be a fast, lightweight, and easy-to-use data communication solution for RPC and coupled modeling in scientific computing. ## What's new +- **2025-12-31(Bug Fix)**: Fixed an issue where shared memory segments were not being properly unregistered from the resource tracker upon closing, which could lead to resource leaks. (PR #17) - **2025-12-15 (Release Improvement)**: Enabled distribution of pre-compiled binary wheels for macOS (Intel/Apple Silicon) and Linux (x86_64/aarch64), eliminating the need for local compilation tools during installation. (PR #15) - **2025-12-10 (Bug Fix)**: Fixed the data type mapping for `U32` fields in Python bindings to ensure correct representation as unsigned 32-bit integers in NumPy arrays. (PR #13) - **2025-12-10 (Bug Fix)**: Fixed an out-of-bounds access issue in `FastVectorDbLayer::Impl::getFieldOffset()` when the field index is equal to the field count. (PR #12) diff --git a/pyproject.toml b/pyproject.toml index f67ed22..fb2f762 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fastdb4py" -version = "0.1.8" +version = "0.1.9" description = "FastCarto database bindings" readme = "README.md" requires-python = ">=3.10" diff --git a/python/fastdb4py/orm/__init__.py b/python/fastdb4py/orm/__init__.py index f96d1b6..ad8190e 100644 --- a/python/fastdb4py/orm/__init__.py +++ b/python/fastdb4py/orm/__init__.py @@ -4,8 +4,8 @@ import numpy as np from pathlib import Path from dataclasses import dataclass -from multiprocessing import shared_memory from typing import List, TypeVar, Type, Any, Generic +from multiprocessing import shared_memory, resource_tracker from .. import core from .table import Table @@ -314,11 +314,18 @@ def get(self, feature_type: Type[T], name: str) -> T | None: return feature_type.map_from(self._origin, of) def close(self): - """Close the database and release resources.""" + """ + Close the database and release resources. + + Warning: + After calling this method, the shared memory database will no longer be accessible. + Make sure to unlink the shared memory if you want to completely remove it through the unlink() method by other processes. + """ if self._shm: self._shm.close() self._shm = None self._origin = None + resource_tracker.unregister(self._shm._name, 'shared_memory') def unlink(self): """Unlink the shared memory database."""