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

Enhance memory allocation strategy #141

Closed
nschlia opened this issue Jan 14, 2023 · 0 comments
Closed

Enhance memory allocation strategy #141

nschlia opened this issue Jan 14, 2023 · 0 comments
Assignees

Comments

@nschlia
Copy link
Owner

nschlia commented Jan 14, 2023

The current implementation of FFmpegfs allocates one page of memory (typically 4096 bytes), then it reserves the entire anticipated amount of memory right away.
If there isn't enough room, it reallocates little bits until the file is the right size.

It could be more effective; FFmpegfs could allocate the entire intended size at once and avoid the inevitable iteration.
And if additional memory is needed, larger chunks should be allocated.

Idea:

  • Keep track of the typical amount of RAM needed for each commit to the buffer.
  • When memory is low, reserve at least n times this average.

That should enable another n or so commits before a new block needs to be allocated.

@nschlia nschlia self-assigned this Jan 14, 2023
nschlia added a commit that referenced this issue Jan 15, 2023
Allocate full expected file size right when opening instead of getting one small block first
nschlia added a commit that referenced this issue Jan 15, 2023
@nschlia nschlia closed this as completed Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant