JuliaInterop / JuliaInterop/JavaCall.jl
Is convert_args safe with finalizer?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 125
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Now JavaCall tries to use saved_args to keep reference of JavaObject while pass arg.ptr into JNI FFI.
https://github.com/JuliaInterop/JavaCall.jl/blob/d6c3678d3a93fae903fb3ab1cb1ea7ea1fc91f92/src/core.jl#L244-L248
But saved_args is not referenced after it created, it might be garbage collected at any time (even before ccall).
I learnt from this gc would only occurs when allocates memory (so current code might work now), but it is hard to trace memory allocation.
Is there any better solution that telling gc not to collect saved_args?
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 with src/core.jl at lines 244-248 and inspect how saved_args is used before the JNI ccall. Review Julia garbage-collection and FFI lifetime behavior, then determine a reproducible way to verify whether the JavaObject reference remains valid. Done means the argument conversion is demonstrably safe from premature collection.
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
- Needs clarification
- Newbie friendliness
- 30/100