Example #1
0
void VMemLogger::PrintLeakReport()
{
#ifdef V3D_MEM_ENABLE_LOGGING
	char buffer[1000];

	std::sprintf(buffer, "Leak report\n");
	std::printf("%s", buffer);
	SendDebugMessage(buffer);

	VMemLogEntry* pEntry = firstLog.pNext;
	long nLeakCount = 0;
	size_t nLeakSize = 0;

	while(pEntry != 0 && pEntry != &lastLog )
	{
		std::sprintf(buffer, "[%s#%s:%d] Size %d\n", 
			pEntry->pModuleName,
			pEntry->pFileName, 
			pEntry->nLine, 
			int(pEntry->nSize));
		std::printf("%s", buffer);
		SendDebugMessage(buffer);
		
		++nLeakCount;
		nLeakSize += pEntry->nSize;

		pEntry = pEntry->pNext;
	}

	std::sprintf(buffer, "\n%d bytes allocated in %d allocations\n",
		int(GetTotalAllocatedMem()), int(GetTotalAllocations()));
	std::printf("%s", buffer);
	SendDebugMessage(buffer);

	std::sprintf(buffer, "%d releases\n", GetTotalReleases());
	std::printf("%s", buffer);
	SendDebugMessage(buffer);

	std::sprintf(buffer, "\n%d bytes of memory leaked in %d places\n\n", 
		nLeakSize, nLeakCount);
	std::printf("%s", buffer);
	SendDebugMessage(buffer);
#else // no logging enabled
	SendDebugMessage("\n\nNo memory logging information available\n\n");
#endif // V3D_MEM_ENABLE_LOGGING
}
Example #2
0
void rvStatAllocator::Report()
{
	// shouchard:  for debugging and tuning only
	common->Printf( "rvStatAllocator:  dump of usage stats\n" );
	common->Printf( "\t%d total bytes handed out in %d requests\n", GetTotalBytesUsed(), GetTotalAllocations() );
	common->Printf( "\tbegin game:    %3d;  end game:      %3d\n", 
		GetAllocationsByType( ST_BEGIN_GAME ), 
		GetAllocationsByType( ST_END_GAME ) );
	common->Printf( "\tplayer hit:    %3d;  player kill:   %3d\n", 
		GetAllocationsByType( ST_HIT ), 
		GetAllocationsByType( ST_KILL ) );
	common->Printf( "\tplayer death:  %3d;\n", 
		GetAllocationsByType( ST_DEATH ) );
	common->Printf( "\tdamage dealt:  %3d;  damage taken:  %3d\n", 
		GetAllocationsByType( ST_DAMAGE_DEALT ),
		GetAllocationsByType( ST_DAMAGE_TAKEN ) );
	common->Printf( "\tstat team:     %3d\n",
		GetAllocationsByType( ST_STAT_TEAM ) );
	common->Printf( "\tflag capture:  %3d;\n",
		GetAllocationsByType( ST_CTF_FLAG_CAPTURE ) ),
	common->Printf( "\tflag drop:     %3d;  flag return:   %3d\n",
		GetAllocationsByType( ST_CTF_FLAG_DROP ),
		GetAllocationsByType( ST_CTF_FLAG_RETURN ) );
}