You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request modifies the build process to bundle CatBoost C API headers and pre-compiled libraries directly into the project, rather than downloading them dynamically. It also introduces a load_buffer_zero_copy method in src/model.rs to address an ARM64 memory leak by using zero-copy model loading. This is noted as a temporary solution.
🎯 Jira Ticket Alignment: ℹ️ Not Found
⚠️ Risk Level: 🟡 Medium
The PR introduces bundled native binaries, replacing dynamic fetching. This shift from dynamic linking to bundled binaries carries a medium risk of platform-specific compatibility issues if not rigorously tested across all target environments. It also acts as a temporary workaround for an ARM64 memory leak, which suggests a degree of instability in the solution.
🧪 Test Coverage
⚠️ No tests added for new load_buffer_zero_copy functionality or for the build process changes, which now rely on bundled binaries.
📊 Root Cause Analysis
The changes are a temporary solution to mitigate a known memory leak issue in CatBoost's internal memory pools on ARM64 (aarch64) when models are loaded from a buffer using the copying mechanism. Bundling the binaries bypasses external dependencies and potentially ensures a specific, stable version for the workaround.
🔗 Dependency Chain
Modified: build.rs, src/model.rs
Impacts: The build process, model loading mechanism, and overall memory footprint/stability, especially on ARM64 platforms.
Dependencies: Removed dynamic download dependencies (ureq and io used for downloads in build.rs). Now implicitly depends on the correctly bundled CatBoost C API libraries (c_api.h, libcatboostmodel.so/.dylib/.dll).
📝 Detailed Changes
New Features:
src/model.rs: Added Model::load_buffer_zero_copy for memory-efficient, zero-copy model loading.
Modified:
build.rs: Refactored to use local, bundled c_api.h and platform-specific libcatboostmodel files instead of downloading them from GitHub releases. Removed io import.
src/model.rs: Added _buffer_owner: Option<Arc<Vec<u8>>> to Model struct to manage the lifetime of zero-copy loaded buffers. Added a warning to the existing load_buffer method about ARM64 memory leaks.
Added:
c_api.h: Bundled CatBoost C API header file.
libcatboostmodel-x86_64.so: Bundled CatBoost shared library for Linux x86_64.
libcatboostmodel.dylib: Bundled CatBoost dynamic library for macOS.
libcatboostmodel.so: Bundled CatBoost shared library for Linux aarch64.
Powered by Gemini 2.5 Flash | Last updated: 15/02/2026 08:49:06 UTC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
local temp solution until 1.2.9 is released