public override void Dispose(bool disposing) { if (pin != null) { pin.Dispose(); } pin = null; }
public void Execute(byte[] data, int length) { using (buffer = new BufferPin(data)) { var handle = GCHandle.Alloc(settings, GCHandleType.Pinned); http_parser_execute(ParserPointer, handle.AddrOfPinnedObject(), buffer.Pointer, (IntPtr)length); handle.Free(); } buffer = null; }
public override int Alloc(int size, out IntPtr ptr) { if (pin == null) { pin = new BufferPin(size); } else if (pin.Buffer.Length < size) { pin.Dispose(); pin = new BufferPin(size); } ptr = pin.Start; return pin.Count.ToInt32(); }
public override int Alloc(int size, out IntPtr ptr) { if (pin == null) { pin = new BufferPin(size); } else if (pin.Buffer.Length < size) { pin.Dispose(); pin = new BufferPin(size); } ptr = pin.Start; return(pin.Count.ToInt32()); }