Comments (4)
I have raised an issue to cover needing to run an old nightly version of rust: rust-lang/rust#46138
from pinboard.
It seems this is due to the implementation of the underling crossbeam garbage collector. The collector doesn't call destructors when garbage expires. This is a deliberate design decision, though it's a little odd.
The way the crossbeam lock-free structures are implemented makes a couple of assumptions:
- Each stored item of data will be retrieved from the structure eventually
- Each stored item of data will only be retrieved once
This means that, for any T
stored in the structure, they can assume that, when the entry is unlink
ed that this is the one and only time that the data will be read, so they simply ptr::read
the T
out of the entry to get the T
back for free. The returned T
will be dropped by the calling code (calling destructors) and the entry will be dropped (without calling destructors) when the garbage is collected.
In pinboard's case, the assumptions do not apply, data can be retrieved multiple times from a pinboard, and, when data is unlink
ed, it is not returned to the caller (in fact, this second facet doesn't really change anything, the caller could never safely drop the returned T
since it doesn't know when enough epochs have passed to ensure no-one else is trying to clone()
it on another thread).
Calling the destructors in the garbage collector is simple, the issue is that it will lead to double frees in the crossbeam lock-free implementations.
from pinboard.
I've proposed a change to crossbeam to call destructors but it's incomplete and probably needs discussion.
from pinboard.
Fixed in #10 and released in v2.0.0
. Note that there's a new restriction on the stored value, that it has to be 'static
to ensure that no references outlive their referent while waiting for collection.
from pinboard.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinboard.