Repository navigation
fix memory leaks in examples - #19
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate memory leaks in the C++ examples (as reported in issue #18), primarily by ensuring Arrow C ABI schemas and query results returned from the C API are properly released/freed.
Changes:
- Release exported
ArrowSchemainstances (c_schema.release) after use in example table creation / writes. - Track result batch count in
examples/simple.cppsearch helper so returned Arrow arrays can be freed correctly. - Free Arrow query results returned by LanceDB (
lancedb_free_arrow_arrays,lancedb_free_arrow_schema) insimple.cppandfull.cpp.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| examples/simple.cpp | Adds schema releases and frees query result Arrow allocations; refactors search return type to include batch count. |
| examples/s3.cpp | Releases exported Arrow schema after table creation to reduce leaks. |
| examples/full.cpp | Releases exported schemas in more places and frees Arrow query results produced by nearest-to queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yuvalif
force-pushed
the
fix-examples-mem-leaks
branch
from
February 23, 2026 10:50
88af51d to
3bef428
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes: lancedb#18 Signed-off-by: Yuval Lifshitz <[email protected]>
yuvalif
force-pushed
the
fix-examples-mem-leaks
branch
from
February 23, 2026 11:41
3bef428 to
dd6d957
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #18