Example #1
0
	void LTMemDisableStackTracking()
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->DisableStackTracking();
		}
	}
Example #2
0
	//function that allows for pushing the context data onto the stack
	void LTMemPopMemoryContext()
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->PopMemoryContext();
		}
	}
Example #3
0
	void LTMemExternalFree(uint32 nMemCategory, uint32 nSize, void *pMemory)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->FreeExternalAllocation(nMemCategory, nSize, pMemory);
		}
	}
Example #4
0
	void LTMemOnExit()
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->OnExit();
		}
	}
Example #5
0
	//function that allows for pushing the context data onto the stack
	void LTMemPushMemoryContext(const char* pszFile, uint32 nLine, uint32 nCategoryID)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->PushMemoryContext(pszFile, nLine, nCategoryID);
		}
	}
Example #6
0
	//This will provide access to the ILTMemory interface.
	ILTMemory*	LTMemGetILTMemory()
	{
		if(VerifyMemoryInterface())
		{
			return g_pILTMemory;
		}
		return NULL;
	}
Example #7
0
	void* operator new[] (size_t nSize)
	{
		if(VerifyMemoryInterface())
		{
			return g_pILTMemory->Allocate((uint32)nSize);
		}

		//no memory interface available, just allocate the data
		return malloc(nSize);
	}
Example #8
0
	//matching delete for our tracked allocator
	void operator delete (void* pData, const char* pszFile, uint32 nLine, uint32 nAllocType)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->Free(pData);
			return;
		}

		free(pData);
	}
Example #9
0
	//overload operator delete
	void operator delete(void* pData)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->Free(pData);
			return;
		}

		free(pData);
	}
Example #10
0
	//overload operator delete
	void operator delete[](void* pData)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->Free(pData);
			return;
		}

		//no memory interface available, just allocate the data
		free(pData);
	}
Example #11
0
	//operator new that also tracks where the memory was allocated from
	void* operator new (size_t nSize, const char* pszFile, uint32 nLine, uint32 nAllocType)
	{
		if(VerifyMemoryInterface())
		{
			g_pILTMemory->SetAllocInfo(pszFile, nLine, nAllocType);
			void* pRV = g_pILTMemory->Allocate(nSize);
			g_pILTMemory->ReleaseAllocInfo();

			return pRV;
		}

		return malloc(nSize);
	}
Example #12
0
	//overload operator new
	void* operator new (size_t nSize)
	{
		if(VerifyMemoryInterface())
		{
			//we have a call to new that did not go through debug new, at least filter it
			//into the appropriate game code section
			g_pILTMemory->SetAllocInfo(__FILE__, __LINE__, LT_MEM_TYPE_UNKNOWN);
			void* pRV = g_pILTMemory->Allocate(nSize);
			g_pILTMemory->ReleaseAllocInfo();

			return pRV;
		}

		return malloc(nSize);
	}