Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Michiel Borkent Today at 11:40 PM
- When I produce a String in a graalvm native library and pass a pointer to it to another language. At what point does that String get garbage collected or freed? So I call free on it myself, and if so, how? (edited)
- 14 replies
- Chris Seaton 5 minutes ago
- Do you mean from the C API?
- Michiel Borkent 3 minutes ago
- So, I'm returning this value: https://github.com/borkdude/sci/blob/e4e860ee343b025514d2de2d7aa0bea097178983/libsci/src/sci/impl/LibSci.java#L15
- And I'm using this value from e.g. C++ or Rust. Who cleans it up eventually? (edited)
- Chris Seaton 3 minutes ago
- Are you familiar with the handles and references in the C API?
- Michiel Borkent 3 minutes ago
- Here is a C++ program that uses this lib:
- https://github.com/borkdude/sci/blob/e4e860ee343b025514d2de2d7aa0bea097178983/libsci/src/from_cpp.cpp#L14 (edited)
- Michiel Borkent 2 minutes ago
- Is this the C API for GraalVM or the C API in general?
- Chris Seaton 2 minutes ago
- graal_create_isolate etc
- Chris Seaton 2 minutes ago
- It has handles and references in that API
- Michiel Borkent 1 minute ago
- I'm not really familiar with it. I barely got this stuff working by imitating examples. Where's the best place to read up on it?
- Chris Seaton 1 minute ago
- I'm not massively clear myself, but I know if you returned an object it's alive within the scope of a handle, or reference, scope
- Chris Seaton 1 minute ago
- It's not well-documented anywhere I can find either
- Chris Seaton 1 minute ago
- You probably need to dig into the source code yourself
- Chris Seaton < 1 minute ago
- Some things I want to do seem to be privileged to the API that the polyglot C API uses.
- Chris Seaton < 1 minute ago
- Have you looked at how the Polyglot C API works? It returns string pointers, that may explain it.
- Michiel Borkent < 1 minute ago
- I have looked at it a bit after you pointed me to it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement