#14 Change the storage of entries and keys internally to use ref count box
Closed: Will not fix 7 years ago Opened 7 years ago by firstyear.

Inside of the b+tree cow, we use entry dup functions. this may waste a lot of memory. As well, we assert that changes to the tree aren't made: Either an delete / insert happens which would cause a new value associated with key (in a new node), which would cause old values to be freed.

A better way, would be to create an internal reference counting box, that ref counts the values and keys in use. This way when they drop to 0, we implicitly free them. It allows external users to gain memory leak safety, and allows us to clamp our memory usage.

As part of this, an "update" or "replace" function should be added that implies delete / insert, but where the value associated to a key has it's ref count dropped, then replaced with a new box.


Thinking about this, it doesn't make sense, because there are cases where we want to fully copy values so we can update them in write threads, and cases where we want to use ref count. I think we can leave this up to the consumer.

Metadata Update from @firstyear:
- Custom field Origin adjusted to Community
- Custom field Review Status adjusted to review

7 years ago

Metadata Update from @firstyear:
- Issue close_status updated to: Will not fix
- Issue status updated to: Closed (was: Open)

7 years ago

Login to comment on this ticket.

Metadata