Giter VIP home page Giter VIP logo

Comments (4)

shekohex avatar shekohex commented on July 1, 2024 1

In allo-isolate we do free the memory regardless of the Dart_PostCObject return value, this the current behavior here:
https://github.com/sunshine-protocol/allo-isolate/blob/51caf0367552bd290ce8b90c62b19db913e68c64/src/lib.rs#L119-L129

Okay, Let's take a deep dive a bit into the VM code.

Where is the Dart_PostCObject?
You will see it is defined here:
https://github.com/dart-lang/sdk/blob/a3f8a9562a8d98be7f3b1cc42bb89854f5c77c90/runtime/vm/native_api_impl.cc#L59-L61 This function does not do a lot on itself, it calls inner function here: https://github.com/dart-lang/sdk/blob/a3f8a9562a8d98be7f3b1cc42bb89854f5c77c90/runtime/vm/native_api_impl.cc#L46-L57 can only return false in one case if the message points to a null memory.

But this only happens, if the WriteApiMessage returned null which is implemented here: https://github.com/dart-lang/sdk/blob/e995cb5f7cd67d39c1ee4bdbe95c8241db36725f/runtime/vm/message_snapshot.cc#L3772-L3781

and again, this would happen if the ApiMessageSerializer failed to Serialize the message.

So, let's see how the ApiMessageSerializer handles the message!

in the Serialize method here: https://github.com/dart-lang/sdk/blob/e995cb5f7cd67d39c1ee4bdbe95c8241db36725f/runtime/vm/message_snapshot.cc#L3613-L3653 you will find it calls Push with the reference to the message https://github.com/dart-lang/sdk/blob/e995cb5f7cd67d39c1ee4bdbe95c8241db36725f/runtime/vm/message_snapshot.cc#L3066-L3071

And here is the stack_.Add(object) https://github.com/dart-lang/sdk/blob/e995cb5f7cd67d39c1ee4bdbe95c8241db36725f/runtime/vm/message_snapshot.cc#L3068 which I guess do a local copy of the value (not 100% sure yet, but I will keep dive more).

To be continued...

from allo-isolate.

fzyzcjy avatar fzyzcjy commented on July 1, 2024 1

Thanks for the detailed reply!

To be continued...

Tell me when you finished ;) I will come back and read the rest

from allo-isolate.

shekohex avatar shekohex commented on July 1, 2024

Is this still an issue?

from allo-isolate.

fzyzcjy avatar fzyzcjy commented on July 1, 2024

@shekohex Yes. allo-isolate does not handle the case when returning false. please see dart-lang/sdk#47270 (comment) and dart-lang/sdk#47270 (comment) (he mentioned he changed the code in the first post)

from allo-isolate.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.