Comments (6)
For the second choice, the name could possibly be CopyBuffer in my opinion.
I think so. I just randomly created the name NonZeroCopyBuffer and it is surely not a name in production :)
from allo-isolate.
Looks interesting. However, I am worried whether this is useful: The time Dart VM returns the memory is non-deterministic. It will be called when GC iirc.
from allo-isolate.
Or maybe we can allow the user to provide a callback closure that would be used after the Dart VM returned the memory. Right now, there is a hardcoded function that takes care of dropping the memory.
Say, we can take the bytes from Rust hashmap, give it to Dart as external data, and when Dart gives it back, Rust could store it back in the hashmap, with the closure provided by the user.
You already could do that! There is the ffi
module, it exposes all the low level things, you can always work on your implementation, struct wrappers, ..etc.
from allo-isolate.
This was something that I also had in mind. though I was not sure what would be the better decision.
For the second choice, the name could possibly be CopyBuffer
in my opinion.
from allo-isolate.
Or maybe we can allow the user to provide a callback closure that would be used after the Dart VM returned the memory. Right now, there is a hardcoded function that takes care of dropping the memory.
Say, we can take the bytes from Rust hashmap, give it to Dart as external data, and when Dart gives it back, Rust could store it back in the hashmap, with the closure provided by the user.
from allo-isolate.
Interesting.. Yes, I do think that we should just mark the code as compiler hint but not deprecated. I do not think there is a way to throw compiler warnings or hints. We could do a compiler error in that code path, However, a better way actually is that we entirely remove/disable the structure as in, only enable the ZeroCopyBuffer struct when the zero-copy feature gets enabled, this way it is more or less making the struct useless, which is okay. The only drawback of that it will make migration harder? Maybe.
For the other point about exposing the opposite of ZeroCopyBuffer (CopyBuffer) I do believe it does not make much sense. If you want to control what is ZeroCopied and what is not, you just remove/disable the feature and you have now the full control.
from allo-isolate.
Related Issues (18)
- Custom types from library result in: `Cell<bool>` cannot be shared between threads safely HOT 2
- Directly find out Dart_PostCObject function pointer, instead of manually letting Dart to call Rust's store_dart_post_cobject? HOT 2
- Publish a new version? HOT 4
- Support `Float32List`? (Can make a PR) HOT 5
- Streaming data HOT 3
- Passing structs through an isolate.post() HOT 2
- Sanitizer errors HOT 6
- Support Vec<Box<XXX>>
- Implicit zero copy on `Vec<u8>` HOT 9
- The official website, Sunshine.foundation, says that domain is being sold... HOT 3
- Is memory copy involved when sending `Uint8List` from Dart to Rust? HOT 2
- bug: DartCObject does not handle cases except Int8/Uint8, making memory leak HOT 2
- Is there any way to run a Rust function on Dart VM shutdown? HOT 2
- bug: Cannot use allo-isolate in two libraries with static linking because of symbol name duplication HOT 4
- bug: Memory leak using Dart_PostCObject because need to consider the return value is true or false HOT 4
- bug: critical DOUBLE-FREE problem for all calls to post() HOT 4
- How is the library tested? (I cannot run it via Valgrind + real Dart) HOT 5
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 allo-isolate.