Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,120 @@
#ifndef __GAMA_FILENAME_H__
#define __GAMA_FILENAME_H__
#pragma once
class GMFilename
{
public:
GMFilename( const char* szFullPath ) ;
void SetDir( const char* szDir ) ;
void SetDrive( const char* szDrive ) ;
void SetExt( const char* szExt ) ;
void SetFilename( const char* szFilename ) ;
const char* GetDir() const ;
const char* GetDrive() const ;
const char* GetExt() const ;
const char* GetFilename() const ;
void GetFullPath( char* pszFullPath ) const ;
private:
void SplitPath( const char* pszStr ) ;
void MakePath( char* pszStr ) const ;
private:
char m_szDir[ _MAX_DIR ] ;
char m_szDrive[ _MAX_DRIVE ] ;
char m_szExt[ _MAX_EXT ] ;
char m_szFilename[ _MAX_FNAME ] ;
} ;
//---------------------------------------------------------------------------
inline void GMFilename::SetDir( const char* szDir )
{
strcpy( m_szDir, szDir ) ;
}
//---------------------------------------------------------------------------
inline void GMFilename::SetDrive( const char* szDrive )
{
strcpy( m_szDrive, szDrive ) ;
}
//---------------------------------------------------------------------------
inline void GMFilename::SetExt( const char* szExt )
{
strcpy( m_szExt, szExt ) ;
}
//---------------------------------------------------------------------------
inline void GMFilename::SetFilename( const char* szFilename )
{
strcpy( m_szFilename, szFilename ) ;
}
//---------------------------------------------------------------------------
inline const char* GMFilename::GetDir() const
{
return m_szDir ;
}
//---------------------------------------------------------------------------
inline const char* GMFilename::GetDrive() const
{
return m_szDrive ;
}
//---------------------------------------------------------------------------
inline const char* GMFilename::GetExt() const
{
return m_szExt ;
}
//---------------------------------------------------------------------------
inline const char* GMFilename::GetFilename() const
{
return m_szFilename ;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
inline GMFilename::GMFilename( const char* szFullPath )
{
SplitPath( szFullPath ) ;
}
//---------------------------------------------------------------------------
inline void GMFilename::GetFullPath( char* pszFullPath ) const
{
MakePath( pszFullPath ) ;
}
//---------------------------------------------------------------------------
// Wrapper/replacement for _splitpath. The char arrays should be allocated
// prior to calling this function.
// This function _does not_ handle multibyte characters.
inline void GMFilename::SplitPath( const char* pszStr )
{
_splitpath( pszStr, m_szDrive, m_szDir, m_szFilename, m_szExt ) ;
}
//---------------------------------------------------------------------------
// Wrapper/replacement for _makepath. pStr should already be allocated prior
// to calling this function
inline void GMFilename::MakePath( char* pszStr ) const
{
_makepath( pszStr, m_szDrive, m_szDir, m_szFilename, m_szExt ) ;
}
#endif // __GAMA_FILENAME_H__

View File

@@ -0,0 +1,928 @@
#include "GMMemory.h"
#include "GMFilename.h"
void TempLogFunction( const char* szFormat, ... )
{
}
#ifdef GM_USE_MEMORY
GMMemoryManager* GMMemoryManager::Instance()
{
static GMMemoryManager ms_this ;
return ( &ms_this ) ;
}
GMMemoryManager::GMMemoryManager()
{
Initialize() ;
}
GMMemoryManager::~GMMemoryManager()
{
Shutdown() ;
}
// ------------------------------------------------------------------------
bool GMMemoryManager::Initialize()
{
m_iCallsNew = 0 ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> Ƚ<><C8BD>
m_iCallsDelete = 0 ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> Ƚ<><C8BD>
m_bUseTracker = true ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
m_bDumpFreedTracker = false ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
m_bDumpAllocFrees = false ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ǥ<><C7A5> <20><><EFBFBD><EFBFBD>
m_dwNextID = 0 ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>ο<EFBFBD><CEBF>Ǵ<EFBFBD> ID
m_dwBytesAllocated = 0 ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
m_dwBytesMaxAllocated = 0 ; // <20>ִ<EFBFBD><D6B4><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
m_dwBytesMaxChunkAllocated = 0 ; // <20>ѹ<EFBFBD><D1B9><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> ûũ<C3BB><C5A9> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
m_dwBytesRunningTotalAllocated = 0 ; // <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>Ѽ<EFBFBD>
m_dwBytesFreed = 0 ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
m_fTimeInit = GetCurrentTimeInSec() ; // <20>ʱ<EFBFBD> <20>ð<EFBFBD> <20><>
m_fTimeMaxAllocated = 0.0f ; // <20>ִ<EFBFBD><D6B4><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD>
m_iTrackerAllocated = 0 ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><>
m_pAvailableTrackerList = NULL ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
m_pAllocatedTrackerList = NULL ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
m_pDeletedTrackerList = NULL ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
m_iTimestampAllocated = 0 ; // Timestamp <20><> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><>
m_pAvailableTimestampList = NULL ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ
m_pTimestampList = NULL ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ
m_pTimestampEnd = NULL ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
m_pLogFile = NULL ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
m_bLogFlushOnWrite = false ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
m_bCommitToDisk = false ;
m_szLogName[ 0 ] = '\0' ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>ϸ<EFBFBD>
m_szLogBuffer[ 0 ] = '\0' ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
m_WriteSize = 0 ; // <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> <20><> ũ<><C5A9>
m_iLogFileCounter = 0 ; // <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> ī<><C4AB><EFBFBD><EFBFBD>
AllocateTrackerBlock() ;
AllocateTimestampBlock() ;
CreateDirectory( "MemoryLog", NULL ) ;
return OpenLogFile( "MemoryLog/RylMemory.log", true, false ) ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::Shutdown()
{
GM_MEMORY_LOG( "\n"
"##################################### \n"
"### Gama Memory Manager Shutting Down... \n"
"##################################### \n\n" ) ;
DumpMemoryStats() ;
DumpMemory() ;
DeleteTrackerBlock() ;
DeleteTimestampBlock() ;
CloseLogFile() ;
}
// ------------------------------------------------------------------------
float GMMemoryManager::GetCurrentTimeInSec()
{
static bool bFirst = true ;
static LARGE_INTEGER freq ;
static LARGE_INTEGER initial ;
if ( bFirst )
{
QueryPerformanceFrequency( &freq ) ;
QueryPerformanceCounter( &initial ) ;
bFirst = false ;
}
LARGE_INTEGER counter ;
QueryPerformanceCounter( &counter ) ;
return (float)( (long double)(counter.QuadPart - initial.QuadPart) / (long double)freq.QuadPart ) ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::DumpMemoryStats()
{
GM_MEMORY_LOG( "######################################## \n"
"### Gama Memory Statistics... \n"
"######################################## \n\n"
"CALLS : \n" ) ;
// <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD> ȣ<><C8A3> Ƚ<><C8BD>
GM_MEMORY_LOG( "new , %9d\n", m_iCallsNew ) ;
GM_MEMORY_LOG( "delete , %9d\n\n", m_iCallsDelete ) ;
GM_MEMORY_LOG( "Allocate tracker , %9d\n", m_iTrackerAllocated ) ;
GM_MEMORY_LOG( "Allocate timestamp , %9d\n", m_iTimestampAllocated ) ;
unsigned long dwBytesAverageChunkSize = 0 ;
if ( m_iCallsNew > 0 )
{
dwBytesAverageChunkSize = m_dwBytesRunningTotalAllocated / m_iCallsNew ;
}
// <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
GM_MEMORY_LOG( "\n\nBYTES : \n" ) ;
GM_MEMORY_LOG( "Currently allocated , %9d , (%8d KB)\n", m_dwBytesAllocated, m_dwBytesAllocated / MEMORY_MULT_KB ) ;
GM_MEMORY_LOG( "Maximum allocated (high water mark) , %9d , (%8d KB)\n", m_dwBytesMaxAllocated, m_dwBytesMaxAllocated / MEMORY_MULT_KB ) ;
GM_MEMORY_LOG( "Largest chunk allocated , %9d , (%8d KB)\n", m_dwBytesMaxChunkAllocated, m_dwBytesMaxChunkAllocated / MEMORY_MULT_KB ) ;
GM_MEMORY_LOG( "Sum of all allocations , %9d , (%8d KB)\n", m_dwBytesRunningTotalAllocated, m_dwBytesRunningTotalAllocated / MEMORY_MULT_KB ) ;
GM_MEMORY_LOG( "Sum af all frees , %9d , (%8d KB)\n", m_dwBytesFreed, m_dwBytesFreed / MEMORY_MULT_KB ) ;
GM_MEMORY_LOG( "Average chunk size , %9d , (%8d KB)\n", dwBytesAverageChunkSize, dwBytesAverageChunkSize / MEMORY_MULT_KB ) ;
// Ÿ<>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
GM_MEMORY_LOG( "\n\nTIMES (seconds after application init) : \n" ) ;
GM_MEMORY_LOG( "High water mark , %9.5f \n\n", m_fTimeMaxAllocated - m_fTimeInit ) ;
STimestamp* pStamp = m_pTimestampList ;
while ( pStamp )
{
GM_MEMORY_LOG( "%-39.39s, %9.5f\n", pStamp->m_szString, pStamp->m_fTime ) ;
pStamp = pStamp->m_pNext ;
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::DumpMemory()
{
if ( m_bUseTracker )
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD> <20>Ҵ<EFBFBD><D2B4>Ǿ<EFBFBD> <20>ִ<EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>
GM_MEMORY_LOG( "\n"
"################################################# \n"
"### Gama Memory Currently Allocated ... \n"
"################################################# \n\n" ) ;
GM_MEMORY_LOG( " ID , Pointer , Size , NewTime , Lifetime , AllocedAtNew , Line , Function, File \n\n" ) ;
float fCurrentTime = GetCurrentTimeInSec() ;
SMemoryTrack* pTrack = m_pAllocatedTrackerList ;
while ( pTrack )
{
GM_MEMORY_LOG( "% 9d , 0x%08x , % 9ld , %10.5f , %10.5f , % 9ld , % 6d , %s, %s\n",
pTrack->m_dwID, reinterpret_cast<unsigned int>(pTrack->m_pMem), pTrack->m_dwSize,
pTrack->m_fTimeNew - m_fTimeInit, fCurrentTime - pTrack->m_fTimeNew,
pTrack->m_dwBytesAllocated, pTrack->m_iLine, pTrack->m_szFunc, pTrack->m_szFile ) ;
pTrack = pTrack->m_pNext ;
}
GM_MEMORY_LOG( "\n" ) ;
}
if ( m_bUseTracker && m_bDumpFreedTracker )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>
GM_MEMORY_LOG( "################################### \n"
"### Gama Freed Memory ... \n"
"################################### \n\n" ) ;
GM_MEMORY_LOG( " ID , Pointer , Size , NewTime , Lifetime , AllocedAtNew , Line , Function, File \n\n" ) ;
SMemoryTrack* pTrack = m_pDeletedTrackerList ;
while ( pTrack )
{
GM_MEMORY_LOG( "% 9d , 0x%08x , % 9ld , %10.5f , %10.5f , % 9ld , % 6d , %s, %s\n",
pTrack->m_dwID, reinterpret_cast<unsigned int>(pTrack->m_pMem), pTrack->m_dwSize,
pTrack->m_fTimeNew - m_fTimeInit, pTrack->m_fTimeDelete - pTrack->m_fTimeNew,
pTrack->m_dwBytesAllocated, pTrack->m_iLine, pTrack->m_szFunc, pTrack->m_szFile ) ;
pTrack = pTrack->m_pNext ;
}
GM_MEMORY_LOG( "\n");
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::CallNew()
{
++m_iCallsNew ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::CallDelete()
{
++m_iCallsDelete ;
}
// ------------------------------------------------------------------------
bool GMMemoryManager::UseTracker()
{
return ( m_bUseTracker ) ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::SetUseTracker( bool bUse )
{
m_bUseTracker = bUse ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::SetDumpFreedTracker( bool bSet )
{
m_bDumpFreedTracker = bSet ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::SetDumpAllocFrees( bool bSet )
{
m_bDumpAllocFrees = bSet ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::AllocateBytes( unsigned long dwSize )
{
m_dwBytesAllocated += dwSize ;
m_dwBytesRunningTotalAllocated += dwSize ;
if ( m_dwBytesAllocated > m_dwBytesMaxAllocated )
{
m_dwBytesMaxAllocated = m_dwBytesAllocated ;
m_fTimeMaxAllocated = GetCurrentTimeInSec() ;
}
if ( dwSize > m_dwBytesMaxChunkAllocated )
{
m_dwBytesMaxChunkAllocated = dwSize ;
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::AllocateBytes( void* pMem, unsigned long dwSize, const char* szFile, const char* szFunc, int iLine )
{
m_dwBytesAllocated += dwSize ;
m_dwBytesRunningTotalAllocated += dwSize ;
float fNewTime = GetCurrentTimeInSec() ;
if ( m_dwBytesAllocated > m_dwBytesMaxAllocated )
{
m_dwBytesMaxAllocated = m_dwBytesAllocated ;
m_fTimeMaxAllocated = fNewTime ;
}
if ( dwSize > m_dwBytesMaxChunkAllocated )
{
m_dwBytesMaxChunkAllocated = dwSize ;
}
if ( m_bDumpAllocFrees )
{
GM_MEMORY_LOG( "Allocate %9d - %9ld - %6d - %s - %s\n", m_dwNextID, dwSize, iLine, szFunc, szFile ) ;
}
SMemoryTrack* pNewTrack = GetFreeTracker() ;
if ( pNewTrack )
{
pNewTrack->m_dwID = m_dwNextID++ ;
pNewTrack->m_pMem = pMem ;
pNewTrack->m_dwSize = dwSize ;
pNewTrack->m_fTimeNew = fNewTime ;
pNewTrack->m_dwBytesAllocated = m_dwBytesAllocated ;
if ( szFile )
{
GMFilename Filename( szFile ) ;
strncpy( pNewTrack->m_szFile, Filename.GetFilename(), PATH_LEN ) ;
strncat( pNewTrack->m_szFile, Filename.GetExt(), PATH_LEN ) ;
}
else
{
pNewTrack->m_szFile[ 0 ] = '\0' ;
}
if ( szFunc )
{
strncpy( pNewTrack->m_szFunc, szFunc, FUNCTION_LEN ) ;
}
else
{
pNewTrack->m_szFunc[ 0 ] = '\0' ;
}
pNewTrack->m_iLine = iLine ;
pNewTrack->m_pNext = m_pAllocatedTrackerList ;
pNewTrack->m_pPrev = NULL ;
if ( m_pAllocatedTrackerList )
{
m_pAllocatedTrackerList->m_pPrev = pNewTrack ;
}
m_pAllocatedTrackerList = pNewTrack ;
}
else
{
assert( !"GMMemoryManager::AllocateBytes() - Get free tracker failed !!" ) ;
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::DeleteBytes( void* pMem, const char* szFile, const char* szFunc, int iLine )
{
assert( NULL != m_pAllocatedTrackerList ) ;
// <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF> ã<>´<EFBFBD>.
bool bFound = false ;
SMemoryTrack* pTrack = m_pAllocatedTrackerList ;
float fDeleteTime = GetCurrentTimeInSec() ;
while ( !bFound )
{
if ( pTrack->m_pMem == pMem )
{
if ( m_bDumpAllocFrees )
{
GM_MEMORY_LOG( "Free %9d - %9ld - %6d - %s - %s\n",
pTrack->m_dwID, pTrack->m_dwSize, pTrack->m_iLine, pTrack->m_szFunc, pTrack->m_szFile ) ;
}
m_dwBytesAllocated -= pTrack->m_dwSize ;
m_dwBytesFreed += pTrack->m_dwSize ;
pTrack->m_fTimeDelete = fDeleteTime ;
// <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
if ( pTrack->m_pNext )
{
pTrack->m_pNext->m_pPrev = pTrack->m_pPrev ;
}
if ( pTrack->m_pPrev )
{
pTrack->m_pPrev->m_pNext = pTrack->m_pNext ;
}
if ( m_pAllocatedTrackerList == pTrack )
{
m_pAllocatedTrackerList = pTrack->m_pNext ;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>߰<EFBFBD>
pTrack->m_pNext = m_pDeletedTrackerList ;
pTrack->m_pPrev = NULL ;
if ( m_pDeletedTrackerList )
{
m_pDeletedTrackerList->m_pPrev = pTrack ;
}
m_pDeletedTrackerList = pTrack ;
bFound = true ;
}
else
{
pTrack = pTrack->m_pNext ;
if ( NULL == pTrack )
{
if ( m_bDumpAllocFrees )
{
GM_MEMORY_LOG( "Free UNKNOWN!\n" ) ;
}
// <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ ü<><C3BC><EFBFBD><EFBFBD> <20>Ҿ<EFBFBD><D2BE><EFBFBD><EFBFBD><EFBFBD> <20><>Ȳ..
// <20>߻<EFBFBD><DFBB>ϸ<EFBFBD> <20>ȵȴ<C8B5>!!
bFound = true ;
}
}
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::Timestamp( const char* szString )
{
if ( NULL != szString )
{
STimestamp* pNewStamp = GetFreeTimestamp() ;
strncpy( pNewStamp->m_szString, szString, MAX_STRING_LEN ) ;
pNewStamp->m_szString[ MAX_STRING_LEN - 1 ] = '\0' ;
pNewStamp->m_fTime = GetCurrentTimeInSec() ;
pNewStamp->m_pPrev = m_pTimestampEnd ;
pNewStamp->m_pNext = NULL ;
if ( NULL == m_pTimestampList )
{
m_pTimestampList = pNewStamp ;
}
if ( m_pTimestampEnd )
{
m_pTimestampEnd->m_pNext = pNewStamp ;
}
m_pTimestampEnd = pNewStamp ;
}
}
// ------------------------------------------------------------------------
void GMMemoryManager::Log( const char* szFormat, ... )
{
assert( NULL != szFormat ) ;
assert( NULL != m_pLogFile ) ;
va_list v_list ;
va_start( v_list, szFormat ) ;
_vsnprintf( m_szLogBuffer, MAX_MEMORY_LOG_OUTPUT_LENGTH, szFormat, v_list ) ;
m_szLogBuffer[ MAX_MEMORY_LOG_OUTPUT_LENGTH - 1 ] = '\0' ;
va_end( v_list ) ;
m_WriteSize += fwrite( m_szLogBuffer, sizeof(char), strlen(m_szLogBuffer), m_pLogFile ) ;
if ( m_bLogFlushOnWrite )
{
fflush( m_pLogFile ) ;
}
if ( m_WriteSize >= MAX_LOG_FILE_SIZE )
{
m_WriteSize = 0 ;
CloseLogFile() ;
OpenNextLogFile() ;
}
}
// ------------------------------------------------------------------------
bool GMMemoryManager::OpenLogFile( const char* szName, bool bFlushOnWrite, bool bCommitToDisk )
{
assert( NULL != szName ) ;
strcpy( m_szLogName, szName ) ;
m_bLogFlushOnWrite = bFlushOnWrite ;
m_bCommitToDisk = bCommitToDisk ;
char szOpenMode[ 5 ] = "wt" ;
if ( bCommitToDisk )
{
strcat( szOpenMode, "c" ) ;
}
m_pLogFile = fopen( m_szLogName, szOpenMode ) ;
if ( NULL == m_pLogFile )
{
assert( !"GMMemoryManager::OpenLogFile() - Failed to open file!" ) ;
return false ;
}
char szMsg[ MAX_MEMORY_LOG_OUTPUT_LENGTH ] ;
SYSTEMTIME sysTime ;
Log( "/*****************************************************\n" ) ;
sprintf( szMsg, "* %s - Log File Opened\n", m_szLogName ) ;
Log( szMsg ) ;
GetSystemTime( &sysTime ) ;
sprintf( szMsg, "* %04d/%02d/%02d - %02d:%02d:%02d\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond ) ;
Log( szMsg ) ;
Log( "*****************************************************/\n" ) ;
return true ;
}
// ------------------------------------------------------------------------
bool GMMemoryManager::OpenNextLogFile()
{
assert( NULL == m_pLogFile ) ;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
char szNextLogName[ MAX_LOG_PATH ] ;
GMFilename filename( m_szLogName ) ;
// sprintf( szNextLogName, "%s%s%02d%s", filename.GetDir(), filename.GetFilename(), ++m_iLogFileCounter, filename.GetExt() ) ;
sprintf( szNextLogName, "%s%02d%s", filename.GetFilename(), ++m_iLogFileCounter, filename.GetExt() ) ;
char szOpenMode[ 5 ] = "wt" ;
if ( m_bCommitToDisk )
{
strcat( szOpenMode, "c" ) ;
}
m_pLogFile = fopen( szNextLogName, szOpenMode ) ;
if ( NULL == m_pLogFile )
{
assert( !"GMMemoryManager::OpenLogFile() - Failed to open file!" ) ;
return false ;
}
char szMsg[ MAX_MEMORY_LOG_OUTPUT_LENGTH ] ;
SYSTEMTIME sysTime ;
Log( "/*****************************************************\n" ) ;
sprintf( szMsg, "* %s - Log File Opened\n", szNextLogName ) ;
Log( szMsg ) ;
GetSystemTime( &sysTime ) ;
sprintf( szMsg, "* %04d/%02d/%02d - %02d:%02d:%02d\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond ) ;
Log( szMsg ) ;
Log( "*****************************************************/\n" ) ;
return true ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::CloseLogFile()
{
if ( NULL != m_pLogFile )
{
char szMsg[ MAX_MEMORY_LOG_OUTPUT_LENGTH ] ;
SYSTEMTIME sysTime ;
Log( "\n" ) ;
Log( "/*****************************************************\n" ) ;
sprintf( szMsg, "* %s - Log File Closed\n", m_szLogName ) ;
Log( szMsg ) ;
GetSystemTime( &sysTime ) ;
sprintf( szMsg, "* %04d/%02d/%02d - %02d:%02d:%02d\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond ) ;
Log( szMsg ) ;
Log( "*****************************************************/\n" ) ;
fclose( m_pLogFile ) ;
}
m_pLogFile = NULL ;
}
//-------------------------------
//-------------------------------
#undef new
#undef malloc
#undef realloc
#undef free
//-------------------------------
//-------------------------------
// ------------------------------------------------------------------------
void GMMemoryManager::AllocateTrackerBlock()
{
SMemoryTrack* pTracker = NULL ;
SMemoryTrack* pLastTracker = NULL ;
pTracker = (SMemoryTrack*)malloc( sizeof(SMemoryTrack) ) ;
assert( NULL != pTracker ) ;
pTracker->m_dwID = 0xFFFFFFFF ;
pTracker->m_pMem = NULL ;
pTracker->m_dwSize = 0 ;
pTracker->m_fTimeNew = 0.0f ;
pTracker->m_fTimeDelete = 0.0f ;
pTracker->m_dwBytesAllocated = 0 ;
pTracker->m_iLine = 0 ;
memset( pTracker->m_szFunc, 0, FUNCTION_LEN ) ;
memset( pTracker->m_szFile, 0, PATH_LEN ) ;
pTracker->m_pNext = m_pAvailableTrackerList ;
if ( m_pAvailableTrackerList )
{
m_pAvailableTrackerList->m_pPrev = pTracker ;
}
pTracker->m_pPrev = NULL ;
pLastTracker = pTracker ;
for ( int i=0; i < TRACKER_ALLOCATE_NUM; ++i )
{
pTracker = (SMemoryTrack*)malloc( sizeof(SMemoryTrack) ) ;
assert( NULL != pTracker ) ;
pTracker->m_dwID = 0xFFFFFFFF ;
pTracker->m_pMem = NULL ;
pTracker->m_dwSize = 0 ;
pTracker->m_fTimeNew = 0.0f ;
pTracker->m_fTimeDelete = 0.0f ;
pTracker->m_dwBytesAllocated = 0 ;
pTracker->m_iLine = 0 ;
memset( pTracker->m_szFunc, 0, FUNCTION_LEN ) ;
memset( pTracker->m_szFile, 0, PATH_LEN ) ;
pTracker->m_pNext = pLastTracker ;
if ( pLastTracker )
{
pLastTracker->m_pPrev = pTracker ;
}
pTracker->m_pPrev = NULL ;
pLastTracker = pTracker ;
++m_iTrackerAllocated ;
}
m_pAvailableTrackerList = pLastTracker ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::DeleteTrackerBlock()
{
SMemoryTrack* pDelete = NULL ;
while ( m_pAvailableTrackerList )
{
pDelete = m_pAvailableTrackerList ;
m_pAvailableTrackerList = m_pAvailableTrackerList->m_pNext ;
free( pDelete ) ;
}
while ( m_pAllocatedTrackerList )
{
pDelete = m_pAllocatedTrackerList ;
m_pAllocatedTrackerList = m_pAllocatedTrackerList->m_pNext ;
free( pDelete ) ;
}
while ( m_pDeletedTrackerList )
{
pDelete = m_pDeletedTrackerList ;
m_pDeletedTrackerList = m_pDeletedTrackerList->m_pNext ;
free( pDelete ) ;
}
m_pAvailableTrackerList = NULL ;
m_pAllocatedTrackerList = NULL ;
m_pDeletedTrackerList = NULL ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::AllocateTimestampBlock()
{
STimestamp* pStamp = NULL ;
STimestamp* pLastStamp = NULL ;
pStamp = (STimestamp*)malloc( sizeof(STimestamp) ) ;
assert( NULL != pStamp ) ;
pStamp->m_szString[ 0 ] = '\0' ;
pStamp->m_fTime = 0.0f ;
pStamp->m_pNext = m_pAvailableTimestampList ;
if ( m_pAvailableTimestampList )
{
m_pAvailableTimestampList->m_pPrev = pStamp ;
}
pStamp->m_pPrev = NULL ;
pLastStamp = pStamp ;
for ( int i = 0; i < TIMESTAMP_ALLOCATE_NUM; ++i )
{
pStamp = (STimestamp*)malloc( sizeof(STimestamp) ) ;
assert( NULL != pStamp ) ;
pStamp->m_szString[ 0 ] = '\0' ;
pStamp->m_fTime = 0.0f ;
pStamp->m_pNext = pLastStamp ;
if ( pLastStamp )
{
pLastStamp->m_pPrev = pStamp ;
}
pStamp->m_pPrev = NULL ;
pLastStamp = pStamp ;
++m_iTimestampAllocated ;
}
m_pAvailableTimestampList = pLastStamp ;
}
// ------------------------------------------------------------------------
void GMMemoryManager::DeleteTimestampBlock()
{
STimestamp* pStamp = NULL ;
while ( m_pAvailableTimestampList )
{
pStamp = m_pAvailableTimestampList ;
m_pAvailableTimestampList = m_pAvailableTimestampList->m_pNext ;
free( pStamp ) ;
}
while ( m_pTimestampList )
{
pStamp = m_pTimestampList ;
m_pTimestampList = m_pTimestampList->m_pNext ;
free( pStamp ) ;
}
m_pAvailableTimestampList = NULL ;
m_pTimestampList = NULL ;
m_pTimestampEnd = NULL ;
}
//---------------------------------------
//---------------------------------------
// Overriding global new and delete...
// ------------------------------------------------------------------------
void* operator new( size_t size )
{
// GM_USE_MEMORY <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD> ȣ<><C8A3><EFBFBD>Ǿ<C7BE><EEBCAD> <20>ȵȴ<C8B5>.
// GM_MEMORY_LOG( "GMMemoryManager: new called instead of new(__FILE__, __FUNCTION__, __LINE__)\n" ) ;
GMMemoryManager::Instance()->CallNew() ;
void* pMem = malloc( size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size) ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void* operator new( size_t size, const char* szFile, const char* szFunc, int iLine )
{
GMMemoryManager::Instance()->CallNew() ;
void* pMem = malloc( size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void* operator new[]( size_t size )
{
// GM_USE_MEMORY <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD> ȣ<><C8A3><EFBFBD>Ǿ<C7BE><EEBCAD> <20>ȵȴ<C8B5>.
// GM_MEMORY_LOG( "GMMemoryManager: new called instead of new(__FILE__, __FUNCTION__, __LINE__)\n" ) ;
GMMemoryManager::Instance()->CallNew() ;
void* pMem = malloc( size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size) ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void* operator new[]( size_t size, const char* szFile, const char* szFunc, int iLine )
{
GMMemoryManager::Instance()->CallNew() ;
void* pMem = malloc( size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void operator delete( void* pMem )
{
if ( pMem )
{
GMMemoryManager::Instance()->CallDelete() ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->DeleteBytes( pMem ) ;
}
free( pMem ) ;
}
}
//---------------------------------------------------------------------------
void operator delete( void* pMem, const char* szFile, const char* szFunc, int iLine )
{
if ( pMem )
{
GMMemoryManager::Instance()->CallDelete() ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->DeleteBytes( pMem, szFile, szFunc, iLine ) ;
}
free( pMem ) ;
}
}
//---------------------------------------------------------------------------
void operator delete[]( void* pMem )
{
if ( pMem )
{
GMMemoryManager::Instance()->CallDelete() ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->DeleteBytes( pMem ) ;
}
free( pMem ) ;
}
}
//---------------------------------------------------------------------------
void operator delete[]( void* pMem, const char* szFile, const char* szFunc, int iLine )
{
if ( pMem )
{
GMMemoryManager::Instance()->CallDelete() ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->DeleteBytes( pMem, szFile, szFunc, iLine ) ;
}
free( pMem ) ;
}
}
//---------------------------------------------------------------------------
void* WrgMalloc( size_t size, const char* szFile, const char* szFunc, int iLine )
{
GMMemoryManager::Instance()->CallNew() ;
void* pMem = malloc( size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void* WrgRealloc( void* pMem, size_t size, const char* szFile, const char* szFunc, int iLine )
{
GMMemoryManager::Instance()->CallNew() ;
pMem = realloc( pMem, size ) ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->AllocateBytes( pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
}
else
{
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
}
return pMem ;
}
//---------------------------------------------------------------------------
void WrgFree( void* pMem, const char* szFile, const char* szFunc, int iLine )
{
if ( pMem )
{
GMMemoryManager::Instance()->CallDelete() ;
if ( GMMemoryManager::Instance()->UseTracker() )
{
GMMemoryManager::Instance()->DeleteBytes( pMem, szFile, szFunc, iLine ) ;
}
free( pMem ) ;
}
}
//---------------------------------------------------------------------------
// delete <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>.
#define new GM_NEW
#define malloc( a ) GM_MALLOC( a )
#define realloc( a, b ) GM_REALLOC( a, b )
#define free( a ) GM_FREE( a )
//-----------------------------------------------------------------------------------------------------
#endif // GM_USE_MEMORY

View File

@@ -0,0 +1,253 @@
#ifndef __GAMA_MEMORY_MANAGER_H__
#define __GAMA_MEMORY_MANAGER_H__
#pragma once
#include <windows.h>
#include <cstdio>
void TempLogFunction( const char* szFormat, ... ) ;
#if defined( GM_USE_MEMORY )
void* operator new( size_t size ) ;
void* operator new[]( size_t size ) ;
void operator delete( void* pMem ) ;
void operator delete[]( void* pMem ) ;
// GM_USE_MEMORY <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> new <20><> <20><><EFBFBD>ϸ<EFBFBD>, <20>Լ<EFBFBD><D4BC><EFBFBD>, <20><><EFBFBD>ι<EFBFBD>ȣ<EFBFBD><C8A3> <20>޴<EFBFBD> new <20><> ȣ<><C8A3><EFBFBD>Ѵ<EFBFBD>.
// delete <20><> <20><><EFBFBD>ϸ<EFBFBD>, <20>Լ<EFBFBD><D4BC><EFBFBD>, <20><><EFBFBD>ι<EFBFBD>ȣ <20>Լ<EFBFBD><D4BC><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
void* operator new( size_t size, const char* szFile, const char* szFunc, int iLine ) ;
void* operator new[]( size_t size, const char* szFile, const char* szFunc, int iLine ) ;
void operator delete( void* pMem, const char* szFile, const char* szFunc, int iLine ) ;
void operator delete[]( void* pMem, const char* szFile, const char* szFunc, int iLine ) ;
void* GMMalloc( size_t size, const char* szFile, const char* szFunc, int iLine ) ;
void* GMRealloc( void* pMem, size_t size, const char* szFile, const char* szFunc, int iLine ) ;
void GMFree( void* pMem, const char* szFile, const char* szFunc, int iLine ) ;
#define GM_NEW new( __FILE__, __FUNCTION__, __LINE__ )
//#define GM_DELETE delete( __FILE__, __FUNCTION__, __LINE__ )
#define GM_MALLOC( a ) GMMalloc( a, __FILE__, __FUNCTION__, __LINE__ )
#define GM_FREE( a ) GMFree( a, __FILE__, __FUNCTION__, __LINE__ )
#define GM_REALLOC( a, b ) GMRealloc( a, b, __FILE__, __FUNCTION__, __LINE__ )
// delete <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>.
#define new GM_NEW
//#define malloc( a ) GM_MALLOC( a )
//#define realloc( a, b ) GM_REALLOC( a, b )
//#define free( a ) GM_FREE( a )
// ---------------------------------------------------------------------------------- //
// //
// new / delete / malloc / realloc / free <20><> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> STATIC Ŭ<><C5AC><EFBFBD><EFBFBD> //
// //
// ---------------------------------------------------------------------------------- //
class GMMemoryManager
{
public :
~GMMemoryManager() ;
static GMMemoryManager* Instance() ;
private :
GMMemoryManager() ;
// Non exist function
GMMemoryManager( const GMMemoryManager& mgr ) ;
GMMemoryManager& operator = ( const GMMemoryManager& mgr ) ;
bool Initialize() ; // <20>ʱ<EFBFBD>ȭ
void Shutdown() ; // <20><><EFBFBD><EFBFBD>
float GetCurrentTimeInSec() ; // <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Լ<EFBFBD>
// ---------------------------------------------------------------
// For memory manage
public :
enum EConst
{
MEMORY_MULT_KB = (1024),
MEMORY_MULT_MB = (1024 * 1024)
} ;
void DumpMemoryStats() ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
void DumpMemory() ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
void CallNew() ; // New ȣ<><C8A3>
void CallDelete() ; // Delete ȣ<><C8A3>
bool UseTracker() ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
void SetUseTracker( bool bUse ) ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
void SetDumpFreedTracker( bool bSet ) ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
void SetDumpAllocFrees( bool bSet ) ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
void AllocateBytes( unsigned long dwSize ) ;
void AllocateBytes( void* pMem, unsigned long dwSize, const char* szFile = 0, const char* szFunc = 0, int iLine = 0 ) ;
void DeleteBytes( void* pMem, const char* szFile = 0, const char* szFunc = 0, int iLine = 0 ) ;
void Timestamp( const char* szString ) ; // Timestamp() <20><><EFBFBD><EFBFBD> GM_TIMESTAMP <20><>ũ<EFBFBD><C5A9> <20><><EFBFBD><EFBFBD>!!
private :
int m_iCallsNew ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> Ƚ<><C8BD>
int m_iCallsDelete ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> Ƚ<><C8BD>
bool m_bUseTracker ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
bool m_bDumpFreedTracker ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
bool m_bDumpAllocFrees ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ǥ<><C7A5> <20><><EFBFBD><EFBFBD>
unsigned long m_dwNextID ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>ο<EFBFBD><CEBF>Ǵ<EFBFBD> ID
unsigned long m_dwBytesAllocated ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
unsigned long m_dwBytesMaxAllocated ; // <20>ִ<EFBFBD><D6B4><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
unsigned long m_dwBytesMaxChunkAllocated ; // <20>ѹ<EFBFBD><D1B9><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> ûũ<C3BB><C5A9> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
unsigned long m_dwBytesRunningTotalAllocated ; // <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>Ѽ<EFBFBD>
unsigned long m_dwBytesFreed ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
float m_fTimeInit ; // <20>ʱ<EFBFBD> <20>ð<EFBFBD> <20><>
float m_fTimeMaxAllocated ; // <20>ִ<EFBFBD><D6B4><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD>
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// For memory tracker
public :
enum ETrackConst
{
PATH_LEN = 64,
FUNCTION_LEN = 64,
TRACKER_ALLOCATE_NUM = 128 // <20><20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20>Ҵ<EFBFBD> <20><>
} ;
struct SMemoryTrack
{
unsigned long m_dwID ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ ID
void* m_pMem ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>ּ<EFBFBD>
unsigned long m_dwSize ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> ũ<><C5A9>
char m_szFile[ PATH_LEN ] ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><> <20><><EFBFBD>ϸ<EFBFBD>
char m_szFunc[ FUNCTION_LEN ] ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><> <20>Լ<EFBFBD><D4BC><EFBFBD>
int m_iLine ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
SMemoryTrack* m_pPrev ; // Prev link
SMemoryTrack* m_pNext ; // Next link
float m_fTimeNew ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>ð<EFBFBD>
float m_fTimeDelete ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD>
unsigned long m_dwBytesAllocated ; // <20>ش<EFBFBD> <20>޸𸮰<DEB8> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> <20>ѷ<EFBFBD>
} ;
void AllocateTrackerBlock() ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD>
void DeleteTrackerBlock() ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
SMemoryTrack* GetFreeTracker() ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF> <20><>ȯ<EFBFBD>ϴ<EFBFBD> <20>Լ<EFBFBD>
private :
int m_iTrackerAllocated ; // <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ<EFBFBD><C4BF> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><>
SMemoryTrack* m_pAvailableTrackerList ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
SMemoryTrack* m_pAllocatedTrackerList ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
SMemoryTrack* m_pDeletedTrackerList ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޸<EFBFBD><DEB8><EFBFBD> Ʈ<><C6AE>Ŀ <20><><EFBFBD><EFBFBD>Ʈ
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// For timestamp
public :
enum ETimestampConst
{
MAX_STRING_LEN = 256, // Timestamp <20><><EFBFBD>ڿ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>
TIMESTAMP_ALLOCATE_NUM = 32 // <20>⺻ Timestamp <20><><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD> <20><>
} ;
struct STimestamp
{
char m_szString[ MAX_STRING_LEN ] ; // Timestamp <20><><EFBFBD>ڿ<EFBFBD>
float m_fTime ; // <20>ð<EFBFBD>
STimestamp* m_pPrev ; // Prev link
STimestamp* m_pNext ; // Next link
} ;
void AllocateTimestampBlock() ; // Timestamp node<64><65> <20>Ҵ<EFBFBD>
void DeleteTimestampBlock() ; // Timestamp node<64><65> <20><><EFBFBD><EFBFBD>
STimestamp* GetFreeTimestamp() ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Timestamp node<64><65> <20><>ȯ<EFBFBD>ϴ<EFBFBD> <20>Լ<EFBFBD>
private :
int m_iTimestampAllocated ; // Timestamp <20><> <20>Ҵ<EFBFBD><D2B4><EFBFBD> <20><>
STimestamp* m_pAvailableTimestampList ; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ
STimestamp* m_pTimestampList ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ
STimestamp* m_pTimestampEnd ; // <20>Ҵ<EFBFBD><D2B4><EFBFBD> Timestamp <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// For log
public :
enum ELogConst
{
MAX_LOG_PATH = 255,
MAX_MEMORY_LOG_OUTPUT_LENGTH = 512,
MAX_LOG_FILE_SIZE = 10 * 1024 * 1024
} ;
void Log( const char* szFormat, ... ) ;
private :
bool OpenLogFile( const char* szName="RowMemory.log", bool bFlushOnWrite=false, bool bCommitToDisk=false ) ;
bool OpenNextLogFile() ;
void CloseLogFile() ;
FILE* m_pLogFile ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
bool m_bLogFlushOnWrite ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
bool m_bCommitToDisk ;
char m_szLogName[ MAX_LOG_PATH ] ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>ϸ<EFBFBD>
char m_szLogBuffer[ MAX_MEMORY_LOG_OUTPUT_LENGTH ] ; // <20>޸<EFBFBD><DEB8><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
size_t m_WriteSize ; // <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> <20><> ũ<><C5A9>
int m_iLogFileCounter ; // <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> ī<><C4AB><EFBFBD><EFBFBD>
// ---------------------------------------------------------------
} ;
#else
#define GM_NEW new
//#define GM_DELETE delete
#define GM_MALLOC malloc
#define GM_FREE free
#define GM_REALLOC realloc
#endif // GM_USE_MEMORY
// Macro define
#if defined( GM_USE_MEMORY )
#define GM_MEMORY_LOG GMMemoryManager::Instance()->Log
#define GM_TIMESTAMP GMMemoryManager::Instance()->Timestamp
#else
#define GM_MEMORY_LOG TempLogFunction
#define GM_TIMESTAMP( str )
#endif // GM_USE_MEMORY
#include "GMMemory.inl"
#endif // __GAMA_MEMORY_MANAGER_H__

View File

@@ -0,0 +1,38 @@
#ifdef GM_USE_MEMORY
#include <cassert>
//------------------------------------------------------------------------------
inline GMMemoryManager::SMemoryTrack* GMMemoryManager::GetFreeTracker()
{
if ( NULL == m_pAvailableTrackerList )
{
AllocateTrackerBlock() ;
}
assert( NULL != m_pAvailableTrackerList && "Allocate tracker block failed !!" ) ;
SMemoryTrack* pTrack = m_pAvailableTrackerList ;
m_pAvailableTrackerList = m_pAvailableTrackerList->m_pNext ;
return pTrack ;
}
//------------------------------------------------------------------------------
inline GMMemoryManager::STimestamp* GMMemoryManager::GetFreeTimestamp()
{
if ( NULL == m_pAvailableTimestampList )
{
AllocateTimestampBlock() ;
}
assert( NULL != m_pAvailableTimestampList && "Allocate timestamp block failed !!" ) ;
STimestamp* pStamp = m_pAvailableTimestampList ;
m_pAvailableTimestampList = m_pAvailableTimestampList->m_pNext ;
return pStamp ;
}
//------------------------------------------------------------------------------
#endif // GM_USE_MEMORY

View File

@@ -0,0 +1,6 @@
#define new GM_NEW
//#define malloc( a ) GM_MALLOC( a )
//#define realloc( a, b ) GM_REALLOC( a, b )
//#define free( a ) GM_FREE( a )

View File

@@ -0,0 +1,5 @@
#undef new
//#undef malloc
//#undef realloc
//#undef free

View File

@@ -0,0 +1,293 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="MemoryManager"
ProjectGUID="{7B602B2E-C629-4311-B7F6-C9177660ADA1}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_NoGD|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug_NoGD|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_MY|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug_MY|Win32"
OutputDirectory="../../Library/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/GMMemory.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="<22>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\GMMemory.cpp">
</File>
</Filter>
<Filter
Name="<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\GMFilename.h">
</File>
<File
RelativePath=".\GMMemory.h">
</File>
<File
RelativePath=".\GMMemory.inl">
</File>
<File
RelativePath=".\GMRedefNew.h">
</File>
<File
RelativePath=".\GMUndefNew.h">
</File>
</Filter>
<Filter
Name="<22><><EFBFBD>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,223 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_MY|Win32">
<Configuration>Debug_MY</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_NoGD|Win32">
<Configuration>Debug_NoGD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_MY|Win32">
<Configuration>Release_MY</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_NoGD|Win32">
<Configuration>Release_NoGD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7B602B2E-C629-4311-B7F6-C9177660ADA1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Library/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath);C:\project\trunk\Client\Library\dxx8\include</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\project\trunk\Client\Library\dxx8\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<OpenMPSupport>
</OpenMPSupport>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;NO_GAMEGUARD;_LIB;_USE_32BIT_TIME_T;</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>
</OpenMPSupport>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="GMMemory.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GMFilename.h" />
<ClInclude Include="GMMemory.h" />
<ClInclude Include="GMRedefNew.h" />
<ClInclude Include="GMUndefNew.h" />
</ItemGroup>
<ItemGroup>
<None Include="GMMemory.inl" />
<None Include="ReadMe.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GMMemory.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GMFilename.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="GMMemory.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="GMRedefNew.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="GMUndefNew.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="GMMemory.inl">
<Filter>헤더 파일</Filter>
</None>
<None Include="ReadMe.txt" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -0,0 +1,21 @@
========================================================================
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺귯<CCBA><EAB7AF> : MemoryManager <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
========================================================================
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>α׷<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BFA1> <20><> MemoryManager <20><><EFBFBD>̺귯<CCBA><EAB7AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾҽ<CABE><D2BD>ϴ<EFBFBD>.
MemoryManager.vcproj
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>α׷<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VC++ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
<20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Visual C++<2B><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD>
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>α׷<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ɿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
/////////////////////////////////////////////////////////////////////////////
<EFBFBD><EFBFBD>Ÿ <20><><EFBFBD><EFBFBD>:
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>α׷<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> "TODO:" <20>ּ<EFBFBD><D6BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20>߰<EFBFBD><DFB0>ϰų<CFB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <20>ϴ<EFBFBD>
<EFBFBD>ҽ<EFBFBD> <20>ڵ<EFBFBD> <20>κ<EFBFBD><CEBA><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD>ϴ<EFBFBD>.
/////////////////////////////////////////////////////////////////////////////