public interface BufferManager extends AutoCloseable
DrillBuf
s that can be reallocated as needed. Upon
re-allocation the old buffer will be freed. Managing a list of these buffers
prevents some parts of the system from needing to define a correct location
to place the final call to free them.
The current uses of these types of buffers are within the pluggable components of Drill.
In UDFs, memory management should not be a concern. We provide access to re-allocatable
DrillBufs to give UDF writers general purpose buffers we can account for. To prevent the need
for UDFs to contain boilerplate to close all of the buffers they request, this list
is tracked at a higher level and all of the buffers are freed once we are sure that
the code depending on them is done executing (currently FragmentContext
and QueryContext.Modifier and Type | Method and Description |
---|---|
void |
close() |
DrillBuf |
getManagedBuffer()
Get a managed buffer of indeterminate size.
|
DrillBuf |
getManagedBuffer(int size)
Get a managed buffer of at least a certain size.
|
DrillBuf |
replace(DrillBuf old,
int newSize)
Replace an old buffer with a new version at least of the provided size.
|
DrillBuf replace(DrillBuf old, int newSize)
old
- Old Buffer that the user is no longer going to use.newSize
- Size of new replacement buffer.DrillBuf getManagedBuffer()
DrillBuf getManagedBuffer(int size)
size
- The desired sizevoid close()
close
in interface AutoCloseable
Copyright © 1970 The Apache Software Foundation. All rights reserved.