Add PhantomRef based YogaNode subclass

Summary: Adds a subclass of `YogaNodeJNIBase` that uses `PhantomReference` for deallocating native memory rather than `Object#finalize()`. This should help making garbage collection more efficient.

Reviewed By: amir-shalem

Differential Revision: D16182667

fbshipit-source-id: d310fdb6af184168c43462b24f5e18ab5d0d7ad0
This commit is contained in:
David Aurelio
2019-07-19 17:16:46 -07:00
committed by Facebook Github Bot
parent 4e4ef06de1
commit 8c0eed3c75
6 changed files with 88 additions and 29 deletions

View File

@@ -10,11 +10,11 @@ import javax.annotation.Nullable;
public abstract class YogaNode {
public static YogaNode create() {
return new YogaNodeJNIBase();
return new YogaNodeJNIFinalizer();
}
public static YogaNode create(YogaConfig config) {
return new YogaNodeJNIBase(config);
return new YogaNodeJNIFinalizer(config);
}
public abstract void reset();