shekohex / allo-isolate

Run Multithreaded Rust along with Dart VM (in isolate) 🌀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: DartCObject does not handle cases except Int8/Uint8, making memory leak

fzyzcjy opened this issue · comments

Hi thanks for the lib. I see DartCObject does not handle cases except Int8/Uint8, making memory leak. It can be clearly seen from the code:

https://github.com/sunshine-protocol/allo-isolate/blob/d10c582aba2a41f65889f1270f009b4c9a4c899b/src/ffi.rs#L161

possibly, a panic can be made instead of no-op.

that's because we only found these are the common types for DartTypedData, feel free to open a PR if you have a use-case that uses other types of DartTypedData.

The commonly used tho is Vec<u8> and as we didn't implement the IntoDart trait for things other than Vec<u8> and Vec<i8> this is not really an issue unless you started using the raw DartCObject on your own.

As I said, if there is a use case, PRs are always welcome!

Sure. My suggestion is to panic for other types, instead of no-op. Because one day if we add other types, and forget to add code here, we want explicit errors, instead of implicitly leaking a lot of memory.