JuliaInterop / JuliaInterop/JavaCall.jl
Possible memory leak in `convert_result`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 125
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
BioformatsLoader.jl has had some problems with OOM-errors. I just added a workaround using local frames (ahnlabb/BioformatsLoader.jl@4d4e2d5decd87c8bfd2bfca2fdfbc4214b120977). However, it seems like this could be a bigger issue with the result variable in convert_result, it is unclear to me when that local reference is deleted (it is not made into a JavaObject and does not have the deleteref finalizer) and the memory leak issues in BioformatsLoader.jl are fixed if an explicit JNI.DeleteLocalRef(result) is added as in ahnlabb/JavaCall.jl@94289c5c1cf60e459d0ee4fb5b8c21b6b98282d6 (potentially relevant SO question).
If you think this is indeed the correct approach I can open a PR from ahnlabb/JavaCall.jl@94289c5c1cf60e459d0ee4fb5b8c21b6b98282d6.
As an aside, BioformatsLoader could possibly benefit from increased control over the byte array life cycle and passing raw byte[] references to Java (as is discussed in #83).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at convert_result and inspect how the result reference is managed, then compare the proposed JNI.DeleteLocalRef(result) change with the referenced JavaCall.j commit. Reproduce the BioformatsLoader.jl OOM behavior if possible and confirm that the memory leak is resolved without breaking result conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100