Crates.io | provenant |
lib.rs | provenant |
version | 0.1.1 |
source | src |
created_at | 2021-04-13 00:20:33.739381 |
updated_at | 2021-04-13 03:15:57.679628 |
description | A version of Arc that can free memory while weak pointers exist by probabilistically tracking provenace. |
homepage | https://github.com/hclarke/provenant |
repository | |
max_upload_size | |
id | 382629 |
size | 9,186 |
A version of Arc<T>
and Weak<T>
that's able to free memory as soon as all of the Arcs are dropped, even if Weak
references remain.
Arc
is droppedWeak
is Copy
It does this by probabilistically tracking provenance at runtime:
the idea is that if the weak pointer's id doesn't match the memory's id, it must have been dropped. it's either zeroed from the drop, or it now has something else in it.
It's possible for weak pointers to get a false positive, if the backing memory gets used for something else and happens to have the id's bit pattern in the same memory location. good luck :)