Skip to content

chore: Add tests for verifying Java GC leaks#1239

Merged
mrousavy merged 6 commits into
mainfrom
test/leak
Mar 3, 2026
Merged

chore: Add tests for verifying Java GC leaks#1239
mrousavy merged 6 commits into
mainfrom
test/leak

Conversation

@mrousavy
Copy link
Copy Markdown
Owner

@mrousavy mrousavy commented Mar 3, 2026

It currently fails on Kotlin - that is expected. Will be fixed by #1238

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nitro-docs Skipped Skipped Mar 3, 2026 2:45pm

Request Review

@mrousavy mrousavy marked this pull request as ready for review March 3, 2026 14:44
@mrousavy mrousavy merged commit 1765308 into main Mar 3, 2026
12 of 13 checks passed
mrousavy added a commit that referenced this pull request Mar 3, 2026
…ing `CxxPart` with `weak_ptr` (#1238)

Separates out the C++ reference we hold in Kotlin to a separate `CxxPart` nested class that holds a `weak_ptr` to C++. That way we break the cyclic reference, and avoid a memory leak which can be reproduced in #1239 

- Fixes a memory leak that happened with all Kotlin Hybrid Objects: margelo/react-native-vision-camera-v5#143 🥳 
- Makes HybridObject initialization a **tiny bit** faster since we no longer call `initHybrid()` multiple times per subclass; now it's overridden and only called once - clean! :)
- `JHybridObject` now only has one implementation for `equals(..)`, `toString()`, and `dispose()`, which is virtual in Java - no need for C++ duplicate implementations
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.

1 participant