A couple of changes intended to avoid high memory consumption.
An important change is the reuse of file handles, by scanning over all handle slots to find a free one. The assumption is that there'll be very few handles at all time (I've seen 4 at most), so the allocation should be fast.
Another critical change is the use of a fixed-size block allocator for the heap.
It's working similar to the file allocator, but using a bitmap for tracking wether blocks are used or not; however, this will be slow and wasteful.
As-is, it will consume about the same memory as before (possibly more), and it will be slower.
This can be tolerated, as future changes (another allocator + free'ing memory) will bring back performance and reduce memory usage significantly.
A couple of changes intended to avoid high memory consumption.
An important change is the reuse of file handles, by scanning over all handle slots to find a free one. The assumption is that there'll be very few handles at all time (I've seen 4 at most), so the allocation should be fast.
Another critical change is the use of a fixed-size block allocator for the heap. It's working similar to the file allocator, but using a bitmap for tracking wether blocks are used or not; however, this will be slow and wasteful. As-is, it will consume about the same memory as before (possibly more), and it will be slower. This can be tolerated, as future changes (another allocator + free'ing memory) will bring back performance and reduce memory usage significantly.