/// <summary> /// Disposes all existing nodes /// </summary> public void Dispose() { while (_head != null) { var headPtr = (IntPtr)_head; _head = _head->Next; Marshal.FreeHGlobal(headPtr); } }
/// <summary> /// Adds a step to the tracer. /// </summary> /// <param name="value"> /// A pointer to the value of the step. /// </param> /// <remarks> /// <paramref name="value"/> is never dereferenced. Two values are considered equal iff the pointers are equal. /// </remarks> public void AddStep(void *value) { _head = _head->Next = (TrackerNode *)Marshal.AllocHGlobal(sizeof(TrackerNode)); _head->Value = value; // ReSharper disable once AssignmentInConditionalExpression if (_oddStep = !_oddStep) { return; } var tail = (IntPtr)_tail; _tail = _tail->Next; Marshal.FreeHGlobal(tail); }