Fork me on GitHub
#graalvm
<
2024-01-03
>
Ingy döt Net20:01:50

The yamlscript binding devs are trying to figure out graalvm native image shared library isolates and isolatethreads, and how to manage them. The rust implementor got 10 times improvement using the same isolate 10k times rather than creating a new one and tearing it down. The function call being used returns a pointer to an allocated string buffer. Afaict the buffers won't be freed until graal_tear_down_isolate(isolatethread) is called. Anyone know much about how isolates work in this regard?

Ingy döt Net21:01:31

@U04V15CAJ I noticed in https://github.com/babashka/sci/blob/master/doc/libsci.md tutorial that you don't call graal_tear_down_isolate at all. I suspect it was to keep things succinct...

borkdude21:01:39

correct, if you want to do it properly you should call tear_down, but if it's a short lived CLI it's not really necessary

Ingy döt Net21:01:00

What I'm trying to figure out is how the thread heap grows for a long lived isolate

borkdude21:01:32

I think it's best to ask this in the GraalVM community slack, native-image channel

borkdude21:01:54

there is stuff to manage this, but I forgot what it was

Ingy döt Net21:01:01

👍 thanks, didn't know about that

borkdude21:01:18

I think they called it pinning, but that's for preventing something to be GC-ed

borkdude21:01:11

I guess pinning is for passing stuff to C and holding on to it via GC: https://www.graalvm.org/sdk/javadoc/index.html?org/graalvm/nativeimage/PinnedObject.html

Ingy döt Net21:01:34

lol, I didn't notice at first but the medium post was my starting point on this whole thing :face_with_rolling_eyes:

Ingy döt Net21:01:20

anyway, chatting with the graal slack peeps seems best

Ingy döt Net21:01:30

will head over there tomorrow

Ingy döt Net21:01:03

calling the buffer returning function in a loop didn't seem to grow ram usage

Ingy döt Net21:01:19

but I'm not great at benchmarking