public abstract class MemoryBuffer extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static interface |
MemoryBuffer.EventHandler
Interface to handle events for this MemoryBuffer.
|
static class |
MemoryBuffer.MemoryBufferCleaner |
Modifier and Type | Field and Description |
---|---|
protected long |
address |
protected MemoryBuffer.MemoryBufferCleaner |
cleaner |
protected boolean |
closed |
protected long |
id |
protected long |
length |
protected int |
refCount |
Modifier | Constructor and Description |
---|---|
protected |
MemoryBuffer(long address,
long length)
Constructor
|
protected |
MemoryBuffer(long address,
long length,
MemoryBuffer.MemoryBufferCleaner cleaner)
Constructor
|
protected |
MemoryBuffer(long address,
long length,
MemoryBuffer parent)
Internal constructor used when creating a slice.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addressOutOfBoundsCheck(long address,
long size,
String type) |
void |
close()
Close this buffer and free memory
|
void |
copyFromMemoryBuffer(long destOffset,
MemoryBuffer src,
long srcOffset,
long length,
Cuda.Stream stream)
Copy a subset of src to this buffer starting at destOffset using the specified CUDA stream.
|
void |
copyFromMemoryBufferAsync(long destOffset,
MemoryBuffer src,
long srcOffset,
long length,
Cuda.Stream stream)
Copy a subset of src to this buffer starting at destOffset using the specified CUDA stream.
|
long |
getAddress()
Returns the location of the data pointed to by this buffer
|
MemoryBuffer.EventHandler |
getEventHandler()
Returns the current event handler for this buffer or null if no handler
is associated or this buffer is closed.
|
long |
getLength()
Returns the size of this buffer
|
int |
getRefCount()
Get the current reference count for this buffer.
|
void |
incRefCount()
Increment the reference count for this column.
|
void |
noWarnLeakExpected()
This is a really ugly API, but it is possible that the lifecycle of a column of
data may not have a clear lifecycle thanks to java and GC.
|
MemoryBuffer.EventHandler |
setEventHandler(MemoryBuffer.EventHandler newHandler)
Set an event handler for this buffer.
|
abstract MemoryBuffer |
slice(long offset,
long len)
Slice off a part of the buffer.
|
String |
toString() |
protected final long address
protected final long length
protected boolean closed
protected int refCount
protected final MemoryBuffer.MemoryBufferCleaner cleaner
protected final long id
protected MemoryBuffer(long address, long length, MemoryBuffer.MemoryBufferCleaner cleaner)
address
- location in memorylength
- size of this buffercleaner
- used to clean up the memory. May be null if no cleanup is needed.protected MemoryBuffer(long address, long length)
address
- location in memorylength
- size of this bufferprotected MemoryBuffer(long address, long length, MemoryBuffer parent)
address
- location in memorylength
- size of this bufferparent
- the buffer that should be closed instead of closing this one.public void noWarnLeakExpected()
public final long getLength()
protected final void addressOutOfBoundsCheck(long address, long size, String type)
public final long getAddress()
public final void copyFromMemoryBuffer(long destOffset, MemoryBuffer src, long srcOffset, long length, Cuda.Stream stream)
destOffset
- the offset in this to start copying from.src
- what to copy fromsrcOffset
- offset into src to start outlength
- how many bytes to copystream
- CUDA stream to usepublic final void copyFromMemoryBufferAsync(long destOffset, MemoryBuffer src, long srcOffset, long length, Cuda.Stream stream)
destOffset
- the offset in this to start copying from.src
- what to copy fromsrcOffset
- offset into src to start outlength
- how many bytes to copystream
- CUDA stream to usepublic abstract MemoryBuffer slice(long offset, long len)
offset
- where to start the slice at.len
- how many bytes to slicepublic MemoryBuffer.EventHandler setEventHandler(MemoryBuffer.EventHandler newHandler)
newHandler
- - the EventHandler to use from this point forwardpublic MemoryBuffer.EventHandler getEventHandler()
public void close()
close
in interface AutoCloseable
public void incRefCount()
public int getRefCount()
Copyright © 2024. All rights reserved.