java-native-access / java-native-access/jna
Cleaner thread too slow
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.9k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
- Version of JNA and related jars. 5.13.0
- Version and vendor of the java virtual machine: openjdk-17.0.8.0 and others
- Operating system: Linux (Debian, OpenSUSE)
- System architecture (CPU type, bitness of the JVM), x86_64
- Complete description of the problem:
I have an application that will sporadically run into a situation where multiple threads are creating lots of short-lived jna.Structure and jna.Union objects. The problem is that jna's single Cleaner thread cannot keep up freeing objects created by multiple parallel threads, so eventually all heap memory will be used up despite the fact that it could be GC'ed. - Steps to reproduce:
See test case.
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 the linked test case in test/com/sun/jna/different_package/CleanerTest.java and reproduce the short-lived Structure and Union workload described in the issue. Read the cleaner implementation and measure whether the single Cleaner thread keeps up under parallel creation. Done means the reported heap growth is addressed without regressing the test case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100