Skip to content

Ignore context parameter in APIs that free handles.#5738

Merged
teo-tsirpanis merged 5 commits intomainfrom
theodoretsirpanis/core-480-remove-or-make-optional-the-context-argument-from-the-free
Jan 29, 2026
Merged

Ignore context parameter in APIs that free handles.#5738
teo-tsirpanis merged 5 commits intomainfrom
theodoretsirpanis/core-480-remove-or-make-optional-the-context-argument-from-the-free

Conversation

@teo-tsirpanis
Copy link
Copy Markdown
Member

As explained in #5219 (review), the requirement to pass contexts in APIs that free handles significantly increases the complexity of lifetime management in APIs for garbage-collected languages, where the objects can be finalized in any order.1

Because freeing these objects is trivial and can only fail if the input pointer is null2, we don't actually need the context to set a detailed error code. Therefore, this PR makes the context parameter optional, and updates all usages to pass nullptr or NULL, depending or the language.


TYPE: C_API
DESC: The context parameter in functions tiledb_aggregate_free, tiledb_query_channel_free and tiledb_query_field_free became unused.

Footnotes

  1. For example, it's not possible to expose the aggregate APIs in TileDB-Go, without rewriting the interop system.

  2. And if the pointer is invalid, but that's UB and we can't do anything about it.

@teo-tsirpanis teo-tsirpanis marked this pull request as ready for review January 28, 2026 22:56
@teo-tsirpanis teo-tsirpanis requested a review from ypatia January 28, 2026 22:56
Copy link
Copy Markdown
Member

@ypatia ypatia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teo-tsirpanis teo-tsirpanis merged commit aa967bc into main Jan 29, 2026
56 checks passed
@teo-tsirpanis teo-tsirpanis deleted the theodoretsirpanis/core-480-remove-or-make-optional-the-context-argument-from-the-free branch January 29, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants