colonelphantom / heap-vec Goto Github PK
View Code? Open in Web Editor NEWRust vec that stores capacity and len on the heap, for smaller stack size
License: Other
Rust vec that stores capacity and len on the heap, for smaller stack size
License: Other
I might start a PR for this soon, but I wanted to create an issue for it. Basically, impl Debug for HeapVec.
I am currently in a situation where I need to avoid random lookups, and this crate has what I need. However, the actual pointer to the underlying memory is still wrapped behind the HeapVec. In my situation, I am looking at using the underlying heap-allocated memory to create an undirected graph. When there is a reallocaton that changes the underlying pointer to the heap allocation, I need to be able to get that updated pointer (or wrapped handle, HeapVec) and update the other pointers in neighbor nodes to that memory. The API I am looking for would definitely be unsafe. I can use pointer comparisons to see if the realloc moved the HeapVec, but if an API is added that would allow me to, for instance, leak the contents of the HeapVec, that would help a lot in supporting what I am working on. For now, I will write a 0
pointer to the memory of the HeapVec, and that should set the *const T
in Unique<T>
to 0, which should effectively perform a leak. When I say leak, I mean exactly like https://doc.rust-lang.org/std/vec/struct.Vec.html#method.leak. All that I want is to ensure that drop()
is not called on the types stored in the vector when I remove the node from its neighbor in the graph.
I am currently working on this approximate nearest neighbor search crate. The biggest problem I have is that I can't have two random lookups for the neighbors of each node (which are dynamic in number) without impacting performance significantly. I have been looking at how I could store the length and capacity for the vector on the heap alongside the memory for the actual data to avoid those extra random accesses, and I ran into this crate. Thanks for making it and figuring out all the alignment stuff. This is an excellent crate, and I think it deserves more attention. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.