java-native-access / java-native-access/jna

Cleaner thread too slow

Open
#1,535 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

  1. Version of JNA and related jars. 5.13.0
  2. Version and vendor of the java virtual machine: openjdk-17.0.8.0 and others
  3. Operating system: Linux (Debian, OpenSUSE)
  4. System architecture (CPU type, bitness of the JVM), x86_64
  5. 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.
  6. Steps to reproduce:
    See test case.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.