Class JCOBridgeDisposeFastScope
Opens a high-performance batch scope for deferred JVM global reference disposal, optimized for synchronous code running on a controlled thread. Disposal of JVM objects within this scope is batched and flushed in a single P/Invoke call when the scope exits, reducing crossing overhead.
public sealed class JCOBridgeDisposeFastScope : IDisposable
- Inheritance
-
JCOBridgeDisposeFastScope
- Implements
- Inherited Members
- Extension Methods
Remarks
This scope is not safe for async/await — if a continuation resumes on a different thread the scope state will not be visible. For async contexts use JCOBridgeDisposeAsyncScope.
using var scope = new JCOBridgeDisposeFastScope();
foreach (var record in consumerRecords)
{
using (record) { /* record disposal is batched */ }
}
Constructors
JCOBridgeDisposeFastScope(int)
Initializes a new high-performance batch dispose scope.
public JCOBridgeDisposeFastScope(int maxPerBatch = 64)
Parameters
maxPerBatchintMaximum number of JVM references to queue before an automatic flush is triggered. Defaults to 64.
Methods
Dispose()
Releases the high-performance batch scope, flushing any queued JVM global reference releases in a single native call. Suppresses finalization after disposal.
public void Dispose()
~JCOBridgeDisposeFastScope()
Finalizer
protected ~JCOBridgeDisposeFastScope()