Class MemoryCleaner
To address these issues the primary way to releasing the resources of a ColumnVector that is stored off of the java heap should be through reference counting. Because memory leaks are really bad for long lived daemons this is intended to be a backup.
When a ColumnVector first allocates off heap resources it should register itself with this along with a Cleaner instance. The Cleaner instance should have no direct links to the ColumnVector that would prevent the ColumnVector from being garbage collected. This will use WeakReferences internally to know when the resources have been leaked. A ColumnVector may keep a reference to the Cleaner instance and either update it as new resources are allocated or use it to release the resources it is holding. Once the ColumnVector's reference count reaches 0 and the resources are released. At some point later the Cleaner itself will be released.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
API that can be used to clean up the resources for a vector, even if there was a leak -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Check if configured the shutdown hook which checks leaks at shutdown time.static void
register
(CompiledExpression expr, MemoryCleaner.Cleaner cleaner) static Runnable
De-register the default shutdown hook from Java default Runtime, then return the corresponding shutdown runnable.
-
Constructor Details
-
MemoryCleaner
public MemoryCleaner()
-
-
Method Details
-
configuredDefaultShutdownHook
public static boolean configuredDefaultShutdownHook()Check if configured the shutdown hook which checks leaks at shutdown time.- Returns:
- true if configured, false otherwise.
-
removeDefaultShutdownHook
De-register the default shutdown hook from Java default Runtime, then return the corresponding shutdown runnable. If you want to register the default shutdown runnable in a custom shutdown hook manager instead of Java default Runtime, should first remove it using this method and then add it- Returns:
- the default shutdown runnable
-
register
-