public final class MemoryCleaner extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
MemoryCleaner.Cleaner
API that can be used to clean up the resources for a vector, even if there was a leak
|
Constructor and Description |
---|
MemoryCleaner() |
Modifier and Type | Method and Description |
---|---|
static boolean |
configuredDefaultShutdownHook()
Check if configured the shutdown hook which checks leaks at shutdown time.
|
static void |
register(CompiledExpression expr,
MemoryCleaner.Cleaner cleaner) |
static Runnable |
removeDefaultShutdownHook()
De-register the default shutdown hook from Java default Runtime, then return the corresponding
shutdown runnable.
|
public static boolean configuredDefaultShutdownHook()
public static Runnable removeDefaultShutdownHook()
public static void register(CompiledExpression expr, MemoryCleaner.Cleaner cleaner)
Copyright © 2024. All rights reserved.