public interface MemoryWorkspace extends AutoCloseable, Deallocatable
Modifier and Type | Interface and Description |
---|---|
static class |
MemoryWorkspace.Type |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ID |
Modifier and Type | Method and Description |
---|---|
PagedPointer |
alloc(long requiredMemory,
DataType dataType,
boolean initialize)
This method does allocation from a given Workspace
|
PagedPointer |
alloc(long requiredMemory,
MemoryKind kind,
DataType dataType,
boolean initialize)
This method does allocation from a given Workspace
|
void |
close()
This method is for compatibility with "try-with-resources" java blocks.
|
void |
destroyWorkspace()
This method causes Workspace destruction: all memory allocations are released after this call.
|
void |
destroyWorkspace(boolean extended) |
void |
enableDebug(boolean reallyEnable)
This method enabled debugging mode for this workspace
|
long |
getCurrentOffset()
This mehtod returns current offset within buffer
|
long |
getCurrentSize()
This methos returns current allocated size of this workspace
|
int |
getDeviceId()
Returns deviceId for this workspace
|
long |
getGenerationId()
This method returns current generation Id
|
String |
getId()
This method returns Id of this workspace
|
long |
getLastCycleAllocations()
This method returns amount of memory consumed in last successful cycle, in bytes
|
long |
getMaxCycleAllocations()
This method returns amount of memory consumed by largest successful cycle, in bytes
|
MemoryWorkspace |
getParentWorkspace()
This method returns parent Workspace, if any.
|
long |
getPrimaryOffset() |
long |
getThisCycleAllocations()
This method returns amount of memory consumed in current cycle, in bytes
|
Long |
getThreadId()
This method returns threadId where this workspace was created
|
WorkspaceConfiguration |
getWorkspaceConfiguration()
This method returns WorkspaceConfiguration bean that was used for given Workspace instance
|
MemoryWorkspace.Type |
getWorkspaceType()
This method returns Type of this workspace
|
void |
initializeWorkspace()
This method causes Workspace initialization
PLEASE NOTE: This call will have no effect on previously initialized Workspace
|
boolean |
isScopeActive()
This method returns True if scope was opened, and not closed yet.
|
MemoryWorkspace |
notifyScopeBorrowed()
This method TEMPORARY enters this workspace, without reset applied
|
MemoryWorkspace |
notifyScopeEntered()
This method notifies given Workspace that new use cycle is starting now
|
MemoryWorkspace |
notifyScopeLeft()
This method notifies given Workspace that use cycle just ended
|
void |
setPreviousWorkspace(MemoryWorkspace memoryWorkspace)
Set the previous workspace, if any
NOTE: this method should only be used if you are fully aware of the consequences of doing so. |
MemoryWorkspace |
tagOutOfScopeUse()
This method temporary disables this workspace
|
void |
toggleWorkspaceUse(boolean isEnabled)
This method allows you to temporary disable/enable given Workspace use.
|
deallocator, getUniqueId, targetDevice
static final String DEFAULT_ID
WorkspaceConfiguration getWorkspaceConfiguration()
MemoryWorkspace.Type getWorkspaceType()
String getId()
int getDeviceId()
Long getThreadId()
long getGenerationId()
PagedPointer alloc(long requiredMemory, DataType dataType, boolean initialize)
requiredMemory
- allocation size, in bytesdataType
- dataType that is going to be usedlong getPrimaryOffset()
PagedPointer alloc(long requiredMemory, MemoryKind kind, DataType dataType, boolean initialize)
requiredMemory
- allocation size, in byteskind
- MemoryKind for allocationdataType
- dataType that is going to be usedMemoryWorkspace notifyScopeEntered()
MemoryWorkspace notifyScopeBorrowed()
MemoryWorkspace notifyScopeLeft()
boolean isScopeActive()
void initializeWorkspace()
void destroyWorkspace()
void destroyWorkspace(boolean extended)
void toggleWorkspaceUse(boolean isEnabled)
isEnabled
- long getThisCycleAllocations()
void enableDebug(boolean reallyEnable)
reallyEnable
- long getLastCycleAllocations()
long getMaxCycleAllocations()
long getCurrentSize()
void close()
close
in interface AutoCloseable
MemoryWorkspace getParentWorkspace()
MemoryWorkspace tagOutOfScopeUse()
void setPreviousWorkspace(MemoryWorkspace memoryWorkspace)
memoryWorkspace
- Workspace to set as the previous workspace. This is the workspace that will become active
when this workspace is closed.long getCurrentOffset()
Copyright © 2020. All rights reserved.