-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The current implementation doesn't seem to do sparse allocation like https://github.com/random-access-storage/random-access-memory.
In short: RandomAccessMemory::buffers should be of type Vec<Option<Vec<u8>>> instead of the current type Vec<Vec<u8>>.
I can see two problems with the current implementation:
-
RandomAccessMemory::write()allocates all pages beforepage_numunnecessarily. Seerandom-access-memory/src/lib.rs
Line 86 in 957856c
self.buffers.resize(page_num + 1, buf); -
RandomAccessMemory::del()seems to be broken. When removing a page it shifts all following pages thereby corrupting the stored data. Compareto https://github.com/random-access-storage/random-access-memory/blob/da2d94570fc48674c22746b288bf65c3bf44015d/index.js#L93random-access-memory/src/lib.rs
Line 183 in 957856c
self.buffers.remove(i);
Metadata
Metadata
Assignees
Labels
No labels