|
|
|
|
|
by mytherin
1359 days ago
|
|
We are allocating and freeing buffers repeatedly. Despite freeing more buffers than we allocate, memory usage might still increase because of internal fragmentation in the allocator. Essentially, fragmentation might create "unused" space that does take up space. This phenomenon is called heap fragmentation [1]. [1] https://cpp4arduino.com/2018/11/06/what-is-heap-fragmentatio... |
|
Technically, I hope you understand that this isn't possible but maybe I am misinterpreting what you're trying to say.
is one way to free "more" buffers than allocated but this will lead to an UB and depending on the underlying system allocator implementation it may or may not crash.However, given how silly this would be I believe this is not what you're trying to convey?