Skip to content

Fix JNI array leaking by freeing the memory after conversion#167

Merged
mkitti merged 1 commit intoJuliaInterop:masterfrom
satanja:jni_array_leak_fix
Jul 18, 2023
Merged

Fix JNI array leaking by freeing the memory after conversion#167
mkitti merged 1 commit intoJuliaInterop:masterfrom
satanja:jni_array_leak_fix

Conversation

@satanja
Copy link
Contributor

@satanja satanja commented Jul 17, 2023

It was observed that JavaCall was leaking memory when getting arrays of objects from Java. This is due to the fact that arrays from Java are converted into Julia arrays by copying the elements over from the Java array, but the Java array is subsequently not freed from memory, causing a leak as at the end of the Julia code the pointer is garbage collected. In #135 essentially the same leak was fixed, but only for primitive arrays, not arrays of Java objects, etc. This PR aims to solve the issue for the remaining cases.

@mkitti
Copy link
Member

mkitti commented Jul 17, 2023

Thank you. I will take a look.

Also, how well does the master branch work for you? The release process got stalled, but we are due for a breaking release.

I'm targeting August 7th for merging and release. Please ping me if not released by then.

@satanja
Copy link
Contributor Author

satanja commented Jul 17, 2023

These are the results when I build and test the repository, see output.txt. I'm running on Julia 1.8.5 and Windows 10.

@mkitti mkitti merged commit d7f3136 into JuliaInterop:master Jul 18, 2023
@satanja
Copy link
Contributor Author

satanja commented Aug 14, 2023

@mkitti What's the status on the release?

@mkitti
Copy link
Member

mkitti commented Aug 14, 2023

I will arrange for it today.

@mkitti
Copy link
Member

mkitti commented Aug 15, 2023

I'm trying to include #165 . Almost there.

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