[code-reflection] RFR: Explicit Arena passing to Tensor construction and Session execution [v7]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Mar 4 14:50:13 UTC 2025
On Tue, 4 Mar 2025 13:46:35 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Holding `Arena` instances in `OnnxRuntime` and `Session` still cause memory leaks.
>> This patch allows to pass explicit arena for `Tensor` construction, `Session` construction and each `Session` run.
>> Improved handling of `Session` life cycle allows to cache live `Session` instead of its protobuf model.
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>
> Caching live sessions insted of proto models
cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java line 362:
> 360: }
> 361:
> 362: public MemorySegment createTensor(Arena arena, MemorySegment flatData, Tensor.ElementType elementType, long[] shape) {
good catch!
cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java line 379:
> 377:
> 378: public long[] tensorShape(MemorySegment tensorAddr) {
> 379: try (var arena = Arena.ofConfined()) {
Also, good catch!
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/337#discussion_r1979612096
PR Review Comment: https://git.openjdk.org/babylon/pull/337#discussion_r1979612427
More information about the babylon-dev
mailing list