RFR: 7904049: Add LLM inference example to jextract samples

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jun 25 16:10:42 UTC 2025


On Wed, 25 Jun 2025 16:07:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Please review this PR to add an LLM inference example to the jextract samples.
>> 
>> Thanks!
>
> samples/onnx/OnnxGenerator.java line 125:
> 
>> 123:     public void close() throws Exception {
>> 124:         arena.close();
>> 125:         OgaDestroyGenerator(generator);
> 
> I wonder if we should `MemorySegment::reinterpret` to associate cleanup action to the various segments -- and then just call `arena.close()` from here?

(this could be achieved by passing a cleanup action to `call` and then calling reinterpret from there with the cleanup action)

-------------

PR Review Comment: https://git.openjdk.org/jextract/pull/285#discussion_r2167095242


More information about the jextract-dev mailing list