Skip to content

Fix Array TrimExcess condition#2421

Merged
bfiete merged 1 commit into
beefytech:masterfrom
cuiweixie:fix/array-trimexcess-condition
Jul 7, 2026
Merged

Fix Array TrimExcess condition#2421
bfiete merged 1 commit into
beefytech:masterfrom
cuiweixie:fix/array-trimexcess-condition

Conversation

@cuiweixie

Copy link
Copy Markdown
Contributor

Summary

TrimExcess() used mSize > mAllocSize, which does not occur for a consistent array (allocated capacity should be at least the used length). The intended check is to shrink when there is spare capacity: mSize < mAllocSize.

Change

  • BeefySysLib/util/Array.h: correct the condition so excess storage is actually released when appropriate.

TrimExcess should shrink the buffer when allocated capacity exceeds the
logical size (mSize < mAllocSize). The previous comparison never held in
valid states.
@bfiete bfiete merged commit d52c13f into beefytech:master Jul 7, 2026
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