public void Dispose() { if (_memoryManager is IRefCounted rc) { rc.DecrementReferenceCount(); _memoryManager = null; _gpuContext.UnregisterProcess(_pid); } }