mpoeter / xenium

A C++ library providing various concurrent data structures and reclamation schemes.
https://mpoeter.github.io/xenium/
MIT License
483 stars 47 forks source link

Proxy-collector reclamation #23

Open ibraheemdev opened 2 years ago

ibraheemdev commented 2 years ago

The original post for the vyukov hashmap mentions a "proxy-collector" used for memory reclamation:

Deferred memory reclamation uses a kind of amortized proxy-collector technique, and together with timestamp based validation provides pure read-only read transactions

But the version here seems to accept arbitrary reclaimers. Was the proxy-collector not implemented?

mpoeter commented 2 years ago

I has been many years since I worked with the original implementation (the implementation in this library is based on one that I created back then). The original implementation by did implement a proxy-collector, but AFAIR it only worked for 32-bit and crashed on 64-bit. The proxy-collector was only used for the table's memory block. because the original implementation was very limited in the supported key/value types (it only supported trivially copyable types of size <= sizeof(void*)).

In my implementation the selected reclamation scheme is used for the table's memory block, as well as for any additional nodes that have to be allocated for non-trivial keys/values. I have considered to allow specification of separate reclaimers for the two cases, but that is not implemented yet.