Skip to content

PNE-8934: Fix native memory leak in EcosSolve JNI wrapper - #25

Merged
andyczerwonka merged 1 commit into
masterfrom
bugfix/PNE-8934_wrapper_memory_leak
Jul 29, 2026
Merged

PNE-8934: Fix native memory leak in EcosSolve JNI wrapper#25
andyczerwonka merged 1 commit into
masterfrom
bugfix/PNE-8934_wrapper_memory_leak

Conversation

@andyczerwonka

@andyczerwonka andyczerwonka commented Jul 29, 2026

Copy link
Copy Markdown

Java_io_citrine_ecos_NativeECOS_EcosSolve pinned 11 JVM arrays via Get*ArrayElements but only released 1 (the output). The 10 input pins were leaked on every solve, in my tests around ~5.75 KB of native RSS per call, JVM heap was flat.

See https://citrineinformatics.slack.com/archives/C06MVKFPYPR/p1785346491886009 for more context.

I confirmed with a local test in Mithril as per @mVenetos97 idea: long story short, we had linear RSS growth on the old version, and now near-flat after this fix. Uses JNI_ABORT since the inputs are read-only, which cheaper than mode 0 and semantically identical here. Releases sit on both the success and failure paths.

Bumps to 0.0.14.

…releasing the 10 read-only input array pins that were previously never freed. Bumps to 0.0.14.

@wjohnald wjohnald left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lg. Thanks for testing this.

@andyczerwonka
andyczerwonka merged commit 2ca3fed into master Jul 29, 2026
1 check passed
@andyczerwonka
andyczerwonka deleted the bugfix/PNE-8934_wrapper_memory_leak branch July 29, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants