Skip to content

i#7798: Add drvector_clear() API#7799

Merged
edeiana merged 13 commits intomasterfrom
i7798-drvector-zero-alloc
Feb 6, 2026
Merged

i#7798: Add drvector_clear() API#7799
edeiana merged 13 commits intomasterfrom
i7798-drvector-zero-alloc

Conversation

@edeiana
Copy link
Copy Markdown
Contributor

@edeiana edeiana commented Feb 3, 2026

This feature enhances drvector by introducing a zero_alloc configuration
and a drvector_clear() API. When zero_alloc is enabled, the container
zero-initializes its internal storage when initializing, resizing, or clearing the
vector. zero_alloc is a config parameter inside the new drvector_config_t
struct and can be passed to the newly introduced drvector_init_ex().
The new drvector_clear() function allows users to empty a drvector's
contents while retaining its allocated capacity for reuse. It invokes the
user-provided free_data_func() for all existing entries
(like drvector_delete()), and zeroes out the storage of the vector if
zero_alloc is set, providing a more efficient alternative to deleting
and re-initializing the container.

Adds documentation about drvector in ext/drcontainers/drcontainers.dox.

Adds a test in suite/tests/client-interface/drcontainers-test.dll.c.

Adds drvector_config_t (which contains zero_alloc),
drvector_init_ex(), and drvector_clear() APIs to release doc.

Version bumped to 11.91 since this PR contains compatibility-breaking
changes.

Fixes #7798

This feature enhances drvector by introducing a `zero_alloc`
configuration and a `drvector_clear()` API.
When `zero_alloc` is enabled, the container zero-initializes
its internal storage when resizing and clearing the vector.
The new `drvector_clear()` function allows users to empty a
drvector's contents while retaining its allocated capacity
for reuse. It invokes the user-provided free_data_func for
all existing entries like `drvector_delete()`, and zeroes
out the storage if zero_alloc is set, providing a more
efficient alternative to deleting and re-initializing the
container.

Adds a test in suite/tests/client-interface/drcontainers-test.dll.c.

Fixes #7798
@edeiana edeiana requested a review from derekbruening February 3, 2026 14:34
Added zero_alloc to release doc.
Copy link
Copy Markdown
Contributor

@derekbruening derekbruening left a comment

Choose a reason for hiding this comment

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

Compatibility needs to be addressed.

@edeiana edeiana requested a review from derekbruening February 6, 2026 01:25
@edeiana edeiana merged commit 5656a45 into master Feb 6, 2026
32 of 34 checks passed
@edeiana edeiana deleted the i7798-drvector-zero-alloc branch February 6, 2026 19:20
edeiana added a commit that referenced this pull request Feb 7, 2026
PR #7799 missed increasing the minor version to
91 for creating a new release, causing the weekly
GitHub CI to fail. Increasing here.

Issue #7798
edeiana added a commit that referenced this pull request Feb 7, 2026
PR #7799 missed increasing the minor version to
91 for creating a new release, causing the weekly
GitHub CI to fail. Increasing here.

Issue #7798
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.

Add API to clear a drvector

2 participants