public void Detach() { if (CurrentState == State.Idle || CurrentState == State.Detached) { return; } Memory.UninitializeMapping(); if (codeCacheHandle != null) { FileMapping.UnmapViewOfFile(codeCachePtr); codeCacheHandle.Close(); codeCacheHandle = null; } if (memoryHandle != null) { memoryHandle.Close(); memoryHandle = null; } if (socket != null) { socket.Close(); socket = null; } OnStateChanged(State.Detached); }
public void UninitializeMapping() { foreach (MapInfo mapInfo in mapInfos) { FileMapping.UnmapViewOfFile(mapInfo.ptr); mapInfo.ptr = IntPtr.Zero; } }