Class PanamaPoolingAllocator
java.lang.Object
ai.tegmentum.wasmtime4j.panama.pool.PanamaPoolingAllocator
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.pool.PoolingAllocator,Closeable,AutoCloseable
public final class PanamaPoolingAllocator
extends Object
implements ai.tegmentum.wasmtime4j.pool.PoolingAllocator
Panama implementation of
PoolingAllocator.
This implementation provides high-performance pooling allocation for WebAssembly execution by reusing pre-allocated memory pools for instances, stacks, and tables.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaPoolingAllocator(ai.tegmentum.wasmtime4j.pool.PoolingAllocatorConfig config) Creates a new PanamaPoolingAllocator with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionlongvoidclose()voidconfigureEngine(ai.tegmentum.wasmtime4j.config.EngineConfig engineConfig) ai.tegmentum.wasmtime4j.pool.PoolingAllocatorConfigGets the native allocator pointer for internal use.ai.tegmentum.wasmtime4j.pool.PoolStatisticsbooleanisValid()voidvoidreleaseInstance(long instanceId) voidvoidreuseInstance(long instanceId) void
-
Constructor Details
-
PanamaPoolingAllocator
public PanamaPoolingAllocator(ai.tegmentum.wasmtime4j.pool.PoolingAllocatorConfig config) throws ai.tegmentum.wasmtime4j.exception.WasmException Creates a new PanamaPoolingAllocator with the specified configuration.- Parameters:
config- the allocator configuration- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException- if the allocator cannot be created
-
-
Method Details
-
getConfig
public ai.tegmentum.wasmtime4j.pool.PoolingAllocatorConfig getConfig()- Specified by:
getConfigin interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator
-
allocateInstance
public long allocateInstance() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
allocateInstancein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
reuseInstance
public void reuseInstance(long instanceId) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
reuseInstancein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
releaseInstance
public void releaseInstance(long instanceId) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
releaseInstancein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
getStatistics
public ai.tegmentum.wasmtime4j.pool.PoolStatistics getStatistics()- Specified by:
getStatisticsin interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator
-
resetStatistics
public void resetStatistics() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
resetStatisticsin interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
warmPools
public void warmPools() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
warmPoolsin interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
performMaintenance
public void performMaintenance() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
performMaintenancein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
configureEngine
public void configureEngine(ai.tegmentum.wasmtime4j.config.EngineConfig engineConfig) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
configureEnginein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
getUptime
- Specified by:
getUptimein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceai.tegmentum.wasmtime4j.pool.PoolingAllocator
-
getNativeAllocator
Gets the native allocator pointer for internal use.- Returns:
- the native allocator pointer
-