public static void Dealloc(ref ByteBuffer buffer) { if (null == buffer) { return; } int size = buffer.Data.Length; if (0 == size || 0 != (size & (size - 1))) { return; } if (size > (1 << maxSizePOT)) { return; } List <ByteBuffer> pool = sPool[sIndexLookup[size]]; int slots = AvailableSlots(pool); if (slots < pool.Count) { buffer.Reset(); pool[slots] = buffer; buffer = null; } }
public void Clear() { _space = _bb.Length; _bb.Reset(); _minAlign = 1; _vtable = null; _objectStart = 0; _vtables = new int[16]; _numVtables = 0; _vectorNumElems = 0; }
public void Clear() { _space = _bb.Length; _bb.Reset(); _minAlign = 1; while (_vtableSize > 0) { _vtable[--_vtableSize] = 0; } _vtableSize = -1; _objectStart = 0; _numVtables = 0; _vectorNumElems = 0; }
/// <summary> /// Create a FlatBufferBuilder backed by the pased in ByteBuffer /// </summary> /// <param name="buffer">The ByteBuffer to write to</param> public FlatBufferBuilder(ByteBuffer buffer) { _bb = buffer; _space = buffer.Length; buffer.Reset(); }