objectbuffer icon indicating copy to clipboard operation
objectbuffer copied to clipboard

[Feat]Iterative/non-blocking memory reclaim

Open Bnaya opened this issue 3 years ago • 0 comments

Current situation: The memory reclaim is a blocking operation, of walking on the graph collect addresses to free into an array, and then call allocator's free on them. This process can be long, and blocks the process that doing do.

Proposal: Write a non-blocking, iterative impl of the same code (can be generator based) The code is written in a way to can be easily refactored to also support iterative variant, that will be to yield the main thread. The scheduling of the iterations will be left to the user, that can use https://www.npmjs.com/package/scheduler or other direct api: https://www.chromestatus.com/feature/6031161734201344

While the whole operation will take longer, we will not freeze the main thread.

Need to take into account: If more addresses will be added to the "to free list"

Where to start? See the processQueuedReclaims api function

Bnaya avatar Jun 14 '21 18:06 Bnaya