public JsonTypeStack(int length, Allocator label) { m_Label = label; m_Stack = (JsonType *)UnsafeUtility.Malloc(length * sizeof(JsonType), UnsafeUtility.AlignOf <JsonType>(), label); m_Length = length; m_Position = -1; }
void Resize(int length) { var buffer = UnsafeUtility.Malloc(length * sizeof(JsonType), UnsafeUtility.AlignOf <JsonType>(), m_Label); UnsafeUtility.MemCpy(buffer, m_Stack, m_Length * sizeof(JsonType)); UnsafeUtility.Free(m_Stack, m_Label); m_Stack = (JsonType *)buffer; m_Length = length; }
public void Dispose() { UnsafeUtility.Free(m_Stack, m_Label); m_Stack = null; }