Skip to content

Camera's native Bullet ray callback is never disposed (JNI leak) #8

Description

@CanReader

The camera creates a native Bullet ray-result callback once and never disposes it. In FocusKingdomCamera:

private ClosestRayResultCallback hitCallback;
...
hitCallback = new ClosestRayResultCallback(new Vector3(), new Vector3());

ClosestRayResultCallback is a JNI/native Bullet object, same category as the bodies and shapes we're careful to dispose everywhere else. But there's no dispose() in this class at all, so when the scene/camera goes away, this native object leaks. It's one per camera so it's not huge, but it's exactly the kind of native leak the project rule about "Bullet objects need explicit dispose in reverse creation order" is meant to catch.

The camera needs a dispose() that calls hitCallback.dispose(), and the scene teardown should call it.

File: core/src/com/focus/kingdom/graphics/camera/FocusKingdomCamera.java, around line 71 and 97 (creation); no matching dispose anywhere in the file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions