You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the scratch allocator "merges" all blocks when it gets reset and create a mega-block with a size equal to the sum of all current blocks like this
Would we allow users to switch between this and the proposed method or should we just implement the proposed method as new default behavior?
Imo I think we should since it would simplify the reset function (since we wouldn't need to allocate a new buffer, just re-use the largest existing one) but it could cause issues when something like this happens (for example):
Allocate 1024 (creates block with size of 1048 or chunk_size)
Allocate 1000 (creates block with size of 1048 (for alignment maybe?) or chunk_size)
Reset (uses block of 1024 as new buffer)
Does 1. and 2. again, which would cause the second allocation to actually need to actually allocate a new buffer for it (unless buffers do not get deallocated, in which case idk why even bother)
In your example, the second block allocated would be 2096 bytes large and that would be the one used next frame (allocate the new block with 2x the size of the previous largest block)
jedjoud10
added a commit
to jedjoud10/phobos-rs
that referenced
this issue
Oct 12, 2023
The text was updated successfully, but these errors were encountered: