graalvm

Ingy döt Net 2024-01-03T20:59:50.827169Z

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 Net 2024-01-03T21:02:31.391819Z

@borkdude 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...

borkdude 2024-01-03T21:07:39.679469Z

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 Net 2024-01-03T21:09:00.589659Z

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

borkdude 2024-01-03T21:09:32.935949Z

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

borkdude 2024-01-03T21:09:54.052979Z

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

Ingy döt Net 2024-01-03T21:10:01.736119Z

👍 thanks, didn't know about that

borkdude 2024-01-03T21:11:18.157879Z

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

borkdude 2024-01-03T21:13:11.553139Z

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 Net 2024-01-03T21:14:34.251059Z

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

Ingy döt Net 2024-01-03T21:15:20.443099Z

anyway, chatting with the graal slack peeps seems best

Ingy döt Net 2024-01-03T21:15:30.839539Z

will head over there tomorrow

Ingy döt Net 2024-01-03T21:19:03.033889Z

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

Ingy döt Net 2024-01-03T21:19:19.056809Z

but I'm not great at benchmarking