Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/util/hb_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool hb_array_append(hb_array_T* array, void* item) {
size_t new_capacity;

if (array->capacity == 0) {
new_capacity = 1;
new_capacity = 8;
Copy link
Copy Markdown
Owner

@marcoroth marcoroth Mar 19, 2026

Choose a reason for hiding this comment

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

I'm wondering if this is really the right approach. Ideally we could have a lazy and/or shared empty array that only uses memory once for all instances. And only when we try to append errors, we convert it to a proper full array with a capacity. Otherwise on the happy path we would allocate a lot of memory that is never going to be used.

} else if (array->capacity > SIZE_MAX / (2 * sizeof(void*))) {
fprintf(stderr, "Warning: Approaching array size limits, using conservative growth.\n");
new_capacity = array->capacity + 1024 / sizeof(void*);
Expand Down
Loading