Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mx alloc overhead reduction #4090

Merged
merged 1 commit into from
Oct 30, 2023
Merged

Conversation

jpalus
Copy link
Contributor

@jpalus jpalus commented Oct 29, 2023

  • What does this PR do?

Improves performance when increasing memory space required for mailbox.

Note that this PR is made on top of #4089. By no means this PR should be merged before #4087 is fixed as increasing grow to 1000 would absolutely blow memory requirements.

  • What are the relevant issue numbers?

Related to #4087.

@jpalus jpalus requested a review from a team as a code owner October 29, 2023 18:04
Fixes neomutt#4087

- Fix overallocation of memory
- Reduce number of re-allocations

Reduce mx allocation overhead by gradually increasing grow step

so far memory allocated for emails grew by capacity of 25 entries per
each call. for big mailboxes this causes quite a lot of reallocations.
change the logic to initially allocate 25 entries while further
expansions double current capacity. cap number of new entries to 1000
though.
@flatcap flatcap added topic:refactoring Code refactoring type:bug Bug labels Oct 30, 2023
@flatcap flatcap linked an issue Oct 30, 2023 that may be closed by this pull request
@flatcap
Copy link
Member

flatcap commented Oct 30, 2023

Squashed and added a comment.

Copy link
Member

@flatcap flatcap left a comment

Choose a reason for hiding this comment

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

What a disaster area mx_alloc_memory() is! :-)

Very nice fix. Thanks ❤️

@flatcap flatcap merged commit 6675b17 into neomutt:main Oct 30, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:refactoring Code refactoring type:bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak after opening maildir mailbox
2 participants