Skip to content

Conversation

BurntSushi
Copy link
Member

Other parts of regex-automata do this implicitly by using Box<[T]>,
btu it's not always straight-forward to use Box<[T]>. (Or, at least,
non-annoying.) In some of those cases here, we call Vec::shrink_to_fit
to decrease memory usage.

These are probably the biggest offenders, but I didn't do a thorough
investigation here.

Fixes #1297

Other parts of `regex-automata` do this implicitly by using `Box<[T]>`,
btu it's not always straight-forward to use `Box<[T]>`. (Or, at least,
non-annoying.) In some of those cases here, we call `Vec::shrink_to_fit`
to decrease memory usage.

These are probably the biggest offenders, but I didn't do a thorough
investigation here.

Fixes #1297
@bobrik
Copy link

bobrik commented Sep 23, 2025

Typo: btu -> but, LGTM otherwise.

@BurntSushi BurntSushi merged commit 02a62ba into master Sep 23, 2025
18 checks passed
@BurntSushi BurntSushi deleted the ag/improve-memory-usage branch September 23, 2025 23:14
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.

Extra memory consumption from Vec growth
2 participants