RudjiGames / MTuner

MTuner is a C/C++ memory profiler and memory leak finder for Windows, PlayStation 4 and 3, Android and other platforms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about addToStackTraceTree code

niqibiao opened this issue · comments

I can't understand why in OpRealloc case, add prevOp to tree, opType is StackTraceTree::Count。Why not StackTraceTree::Free?Could you give me some suggestions?

void Capture::addToStackTraceTree(StackTraceTree& _tree, MemoryOperation* _op, StackTrace::Scope _offset)
{
	switch (_op->m_operationType)
	{
                //...
		case rmem::LogMarkers::OpReallocAligned:
		case rmem::LogMarkers::OpRealloc:
			{
				MemoryOperation* prevOp = _op->m_chainPrev;
				if (prevOp)
				{
					if (isInFilter(prevOp))
						addToTree(&_tree, prevOp->m_stackTrace, -(int64_t)prevOp->m_allocSize, -(int32_t)prevOp->m_overhead, _offset, StackTraceTree::Count, _op->m_operationTime);
				}
				addToTree(&_tree, _op->m_stackTrace, _op->m_allocSize, _op->m_overhead, _offset, StackTraceTree::Realloc, _op->m_operationTime);
			}
			break;
	};
}

Look how the value is being used afterwards and it should give you enough hints.
I'm closing this as it's not an issue with MTuner.