Class JNINativeFinalizer


  • public final class JNINativeFinalizer
    extends java.lang.Object
    Internal Only. This class is held on to by the RefCounted classes and nulled when that object is collected. It has no references to any (non static) members and so its finalize() method will not hold up the collection of any other object.

    It exists so that we still have a mechanism that always frees native memory; in most cases the JNIReference will enqueue correctly with the JNIMemoryManager, and then the next call to a Ferry based method will drain that queue, but sometimes there is no extra call to one of those methods; in this case we'll drain the queue when this gets finalized.

    It does a JNIMemoryManager.gc() which might race with the JNIMemoryManager.gc() that a JNIReference does on allocation of a new object but that's a safe race.

    Author:
    aclarke