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.
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:
That should enable another n or so commits before a new block needs to be allocated.