Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
120
MemoryManager/GMFilename.h
Normal file
120
MemoryManager/GMFilename.h
Normal 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__
|
||||
825
MemoryManager/GMMemory.cpp
Normal file
825
MemoryManager/GMMemory.cpp
Normal file
@@ -0,0 +1,825 @@
|
||||
|
||||
#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 ; // 메모리 할당 횟수
|
||||
m_iCallsDelete = 0 ; // 메모리 해제 횟수
|
||||
|
||||
m_bUseTracker = true ; // 메모리 트래커 사용 여부
|
||||
m_bDumpAllocFrees = false ; // 메모리 할당 / 해제시 정보 표시 여부
|
||||
|
||||
m_dwNextID = 0 ; // 메모리 할당시 부여되는 ID
|
||||
|
||||
m_dwBytesAllocated = 0 ; // 할당된 메모리 바이트 수
|
||||
m_dwBytesMaxAllocated = 0 ; // 최대로 할당된 메모리 바이트 수
|
||||
m_dwBytesMaxChunkAllocated = 0 ; // 한번에 할당된 메모리 청크의 최대 바이트 수
|
||||
m_dwBytesRunningTotalAllocated = 0 ; // 실행중에 할당된 메모리 바이트 총수
|
||||
m_dwBytesFreed = 0 ; // 해제된 메모리 바이트 수
|
||||
|
||||
m_fTimeInit = GetCurrentTimeInSec() ; // 초기 시간 값
|
||||
m_fTimeMaxAllocated = 0.0f ; // 최대로 할당된 때의 시간
|
||||
|
||||
m_pAllocatedTrackerList = NULL ; // 할당된 메모리의 메모리 트래커 리스트
|
||||
|
||||
m_iTimestampAllocated = 0 ; // Timestamp 가 할당된 수
|
||||
|
||||
m_pAvailableTimestampList = NULL ; // 사용 가능한 Timestamp 리스트
|
||||
m_pTimestampList = NULL ; // 할당된 Timestamp 리스트
|
||||
m_pTimestampEnd = NULL ; // 할당된 Timestamp 리스트 마지막 노드
|
||||
|
||||
m_pLogFile = NULL ; // 메모리 로그 파일
|
||||
m_bLogFlushOnWrite = false ; // 메모리 로그 파일에 쓸때마다 플러쉬 여부
|
||||
m_bCommitToDisk = false ;
|
||||
m_szLogName[ 0 ] = '\0' ; // 메모리 로그 파일명
|
||||
m_szLogBuffer[ 0 ] = '\0' ; // 메모리 로그 버퍼
|
||||
m_WriteSize = 0 ; // 현재 로그 파일에 쓴 크기
|
||||
m_iLogFileCounter = 0 ; // 로그 파일 인덱스 카운터
|
||||
|
||||
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" ) ;
|
||||
|
||||
// 메모리 할당 / 해제 호출 횟수
|
||||
GM_MEMORY_LOG( "new , %9d\n", m_iCallsNew ) ;
|
||||
GM_MEMORY_LOG( "delete , %9d\n\n", m_iCallsDelete ) ;
|
||||
GM_MEMORY_LOG( "Allocate timestamp , %9d\n", m_iTimestampAllocated ) ;
|
||||
|
||||
unsigned long dwBytesAverageChunkSize = 0 ;
|
||||
if ( m_iCallsNew > 0 )
|
||||
{
|
||||
dwBytesAverageChunkSize = m_dwBytesRunningTotalAllocated / m_iCallsNew ;
|
||||
}
|
||||
|
||||
// 메모리 할당 / 해제 바이트 정보
|
||||
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 ) ;
|
||||
|
||||
// 타임스탬프 정보
|
||||
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 )
|
||||
{
|
||||
// 아직 해제되지 않고 할당되어 있는 메모리 정보
|
||||
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" ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
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::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( SMemoryTrack* pNewTrack, void* pMem, unsigned long dwSize, const char* szFile, const char* szFunc, int iLine )
|
||||
{
|
||||
assert( NULL != pNewTrack && "New track is null !!" ) ;
|
||||
assert( NULL != pMem && "Client memory pointer is null !!" ) ;
|
||||
|
||||
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 ) ;
|
||||
}
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
void GMMemoryManager::DeleteBytes( SMemoryTrack* pDeleteTrack, const char* szFile, const char* szFunc, int iLine )
|
||||
{
|
||||
assert( NULL != pDeleteTrack && "Delete track is null !!" ) ;
|
||||
assert( NULL != m_pAllocatedTrackerList ) ;
|
||||
|
||||
float fDeleteTime = GetCurrentTimeInSec() ;
|
||||
|
||||
if ( m_bDumpAllocFrees )
|
||||
{
|
||||
GM_MEMORY_LOG( "Free %9d - %9ld - %6d - %s - %s\n",
|
||||
pDeleteTrack->m_dwID, pDeleteTrack->m_dwSize, pDeleteTrack->m_iLine,
|
||||
pDeleteTrack->m_szFunc, pDeleteTrack->m_szFile ) ;
|
||||
}
|
||||
|
||||
m_dwBytesAllocated -= pDeleteTrack->m_dwSize ;
|
||||
m_dwBytesFreed += pDeleteTrack->m_dwSize ;
|
||||
pDeleteTrack->m_fTimeDelete = fDeleteTime ;
|
||||
|
||||
// 할당된 메모리 트래커 리스트에서 제거
|
||||
if ( pDeleteTrack->m_pNext )
|
||||
{
|
||||
pDeleteTrack->m_pNext->m_pPrev = pDeleteTrack->m_pPrev ;
|
||||
}
|
||||
|
||||
if ( pDeleteTrack->m_pPrev )
|
||||
{
|
||||
pDeleteTrack->m_pPrev->m_pNext = pDeleteTrack->m_pNext ;
|
||||
}
|
||||
|
||||
if ( m_pAllocatedTrackerList == pDeleteTrack )
|
||||
{
|
||||
m_pAllocatedTrackerList = pDeleteTrack->m_pNext ;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
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 ) ;
|
||||
|
||||
// 생성할 로그 파일 이름을 만든다.
|
||||
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::DeleteTrackerBlock()
|
||||
{
|
||||
SMemoryTrack* pDelete = NULL ;
|
||||
|
||||
while ( m_pAllocatedTrackerList )
|
||||
{
|
||||
pDelete = m_pAllocatedTrackerList ;
|
||||
m_pAllocatedTrackerList = m_pAllocatedTrackerList->m_pNext ;
|
||||
free( (void*)pDelete ) ;
|
||||
}
|
||||
|
||||
m_pAllocatedTrackerList = 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 를 사용할때 호출되어서는 안된다.
|
||||
// GM_MEMORY_LOG( "GMMemoryManager: new called instead of new(__FILE__, __FUNCTION__, __LINE__)\n" ) ;
|
||||
|
||||
GMMemoryManager::Instance()->CallNew() ;
|
||||
void* pMem = NULL ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = malloc( sizeof(GMMemoryManager::SMemoryTrack) + size ) ;
|
||||
|
||||
GMMemoryManager::SMemoryTrack* pTrack = static_cast<GMMemoryManager::SMemoryTrack* >( pMem ) ;
|
||||
pMem = (void*)( (char*)pMem + sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( pTrack, pMem, static_cast<unsigned long>(size) ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pMem = malloc( size ) ;
|
||||
|
||||
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 = NULL ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = malloc( sizeof(GMMemoryManager::SMemoryTrack) + size ) ;
|
||||
|
||||
GMMemoryManager::SMemoryTrack* pTrack = static_cast<GMMemoryManager::SMemoryTrack* >( pMem ) ;
|
||||
pMem = (void*)( (char*)pMem + sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( pTrack, pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pMem = malloc( size ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
|
||||
}
|
||||
|
||||
return pMem ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void* operator new[]( size_t size )
|
||||
{
|
||||
// GM_USE_MEMORY 를 사용할때 호출되어서는 안된다.
|
||||
// GM_MEMORY_LOG( "GMMemoryManager: new called instead of new(__FILE__, __FUNCTION__, __LINE__)\n" ) ;
|
||||
|
||||
GMMemoryManager::Instance()->CallNew() ;
|
||||
void* pMem = NULL ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = malloc( sizeof(GMMemoryManager::SMemoryTrack) + size ) ;
|
||||
|
||||
GMMemoryManager::SMemoryTrack* pTrack = static_cast<GMMemoryManager::SMemoryTrack* >( pMem ) ;
|
||||
pMem = (void*)( (char*)pMem + sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( pTrack, pMem, static_cast<unsigned long>(size) ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pMem = malloc( size ) ;
|
||||
|
||||
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 = NULL ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = malloc( sizeof(GMMemoryManager::SMemoryTrack) + size ) ;
|
||||
|
||||
GMMemoryManager::SMemoryTrack* pTrack = static_cast<GMMemoryManager::SMemoryTrack* >( pMem ) ;
|
||||
pMem = (void*)( (char*)pMem + sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( pTrack, pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pMem = malloc( size ) ;
|
||||
|
||||
GMMemoryManager::Instance()->AllocateBytes( static_cast<unsigned long>(size) ) ;
|
||||
}
|
||||
|
||||
return pMem ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void operator delete( void* pMem )
|
||||
{
|
||||
if ( pMem )
|
||||
{
|
||||
GMMemoryManager::Instance()->CallDelete() ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = (void*)( (char*)pMem - sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->DeleteBytes( (GMMemoryManager::SMemoryTrack*)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() )
|
||||
{
|
||||
pMem = (void*)( (char*)pMem - sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->DeleteBytes( (GMMemoryManager::SMemoryTrack*)pMem, szFile, szFunc, iLine ) ;
|
||||
}
|
||||
|
||||
free( pMem ) ;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void operator delete[]( void* pMem )
|
||||
{
|
||||
if ( pMem )
|
||||
{
|
||||
GMMemoryManager::Instance()->CallDelete() ;
|
||||
|
||||
if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
{
|
||||
pMem = (void*)( (char*)pMem - sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->DeleteBytes( (GMMemoryManager::SMemoryTrack*)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() )
|
||||
{
|
||||
pMem = (void*)( (char*)pMem - sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
|
||||
GMMemoryManager::Instance()->DeleteBytes( (GMMemoryManager::SMemoryTrack*)pMem, szFile, szFunc, iLine ) ;
|
||||
}
|
||||
|
||||
free( pMem ) ;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//void* WrgMalloc( size_t size, const char* szFile, const char* szFunc, int iLine )
|
||||
//{
|
||||
// GMMemoryManager::Instance()->CallNew() ;
|
||||
// void* pMem = NULL ;
|
||||
//
|
||||
// if ( GMMemoryManager::Instance()->UseTracker() )
|
||||
// {
|
||||
// pMem = malloc( sizeof(GMMemoryManager::SMemoryTrack) + size ) ;
|
||||
//
|
||||
// GMMemoryManager::SMemoryTrack* pTrack = static_cast<GMMemoryManager::SMemoryTrack* >( pMem ) ;
|
||||
// pMem = (void*)( (char*)pMem + sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
//
|
||||
// GMMemoryManager::Instance()->AllocateBytes( pTrack, pMem, static_cast<unsigned long>(size), szFile, szFunc, iLine ) ;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pMem = malloc( size ) ;
|
||||
//
|
||||
// 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() )
|
||||
// {
|
||||
// pMem = (void*)( (char*)pMem - sizeof(GMMemoryManager::SMemoryTrack) ) ;
|
||||
//
|
||||
// GMMemoryManager::Instance()->DeleteBytes( (GMMemoryManager::SMemoryTrack*)pMem, szFile, szFunc, iLine ) ;
|
||||
// }
|
||||
//
|
||||
// free( pMem ) ;
|
||||
// }
|
||||
//}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// delete 는 쉽게 재정의 할수 없다.
|
||||
#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
|
||||
243
MemoryManager/GMMemory.h
Normal file
243
MemoryManager/GMMemory.h
Normal file
@@ -0,0 +1,243 @@
|
||||
|
||||
#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 사용시 new 를 파일명, 함수명, 라인번호를 받는 new 로 호출한다.
|
||||
// delete 는 파일명, 함수명, 라인번호 함수가 호출되지 않는다.
|
||||
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_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 는 쉽게 재정의 할수 없다.
|
||||
#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 의 메모리 사용정보를 관리하는 STATIC 클래스 //
|
||||
// //
|
||||
// ---------------------------------------------------------------------------------- //
|
||||
|
||||
class GMMemoryManager
|
||||
{
|
||||
public :
|
||||
|
||||
~GMMemoryManager() ;
|
||||
|
||||
static GMMemoryManager* Instance() ;
|
||||
|
||||
private :
|
||||
|
||||
GMMemoryManager() ;
|
||||
|
||||
// Non exist function
|
||||
GMMemoryManager( const GMMemoryManager& mgr ) ;
|
||||
GMMemoryManager& operator = ( const GMMemoryManager& mgr ) ;
|
||||
|
||||
bool Initialize() ; // 초기화
|
||||
void Shutdown() ; // 종료
|
||||
|
||||
float GetCurrentTimeInSec() ; // 시간을 얻어오는 함수
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// For memory tracker
|
||||
public :
|
||||
|
||||
enum ETrackConst
|
||||
{
|
||||
PATH_LEN = 64,
|
||||
FUNCTION_LEN = 64,
|
||||
TRACKER_ALLOCATE_NUM = 512 // 기본 메모리 트래커 할당 수
|
||||
} ;
|
||||
|
||||
struct SMemoryTrack
|
||||
{
|
||||
unsigned long m_dwID ; // 메모리 트래커 ID
|
||||
void* m_pMem ; // 메모리 주소
|
||||
|
||||
unsigned long m_dwSize ; // 할당된 크기
|
||||
char m_szFile[ PATH_LEN ] ; // 메모리 할당을 한 파일명
|
||||
char m_szFunc[ FUNCTION_LEN ] ; // 메모리 할당을 한 함수명
|
||||
int m_iLine ; // 메모리 할당을 한 라인
|
||||
|
||||
SMemoryTrack* m_pPrev ; // Prev link
|
||||
SMemoryTrack* m_pNext ; // Next link
|
||||
|
||||
float m_fTimeNew ; // 할당된 시간
|
||||
float m_fTimeDelete ; // 해제된 시간
|
||||
|
||||
unsigned long m_dwBytesAllocated ; // 해당 메모리가 할당된 시점에서의 할당된 메모리 총량
|
||||
} ;
|
||||
|
||||
void DeleteTrackerBlock() ; // 메모리 트래커들을 해제
|
||||
|
||||
private :
|
||||
|
||||
SMemoryTrack* m_pAllocatedTrackerList ; // 할당된 메모리의 메모리 트래커 리스트
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// For memory manage
|
||||
public :
|
||||
|
||||
enum EConst
|
||||
{
|
||||
MEMORY_MULT_KB = (1024),
|
||||
MEMORY_MULT_MB = (1024 * 1024)
|
||||
} ;
|
||||
|
||||
void DumpMemoryStats() ; // 메모리 사용 통계 정보 출력
|
||||
void DumpMemory() ; // 메모리 할당 / 해제 정보 출력
|
||||
|
||||
void CallNew() ; // New 호출
|
||||
void CallDelete() ; // Delete 호출
|
||||
|
||||
bool UseTracker() ; // 메모리 트래커 사용 여부 확인
|
||||
void SetUseTracker( bool bUse ) ; // 메모리 트래커 사용 여부 설정
|
||||
void SetDumpAllocFrees( bool bSet ) ; // 메모리 할당 / 해제시 로깅 여부 설정
|
||||
|
||||
void AllocateBytes( unsigned long dwSize ) ;
|
||||
void AllocateBytes( SMemoryTrack* pNewTrack, void* pMem, unsigned long dwSize, const char* szFile = 0, const char* szFunc = 0, int iLine = 0 ) ;
|
||||
void DeleteBytes( SMemoryTrack* pDeleteTrack, const char* szFile = 0, const char* szFunc = 0, int iLine = 0 ) ;
|
||||
|
||||
void Timestamp( const char* szString ) ; // Timestamp() 대신 GM_TIMESTAMP 매크로 사용!!
|
||||
|
||||
private :
|
||||
|
||||
int m_iCallsNew ; // 메모리 할당 횟수
|
||||
int m_iCallsDelete ; // 메모리 해제 횟수
|
||||
|
||||
bool m_bUseTracker ; // 메모리 트래커 사용 여부
|
||||
bool m_bDumpAllocFrees ; // 메모리 할당 / 해제시 정보 표시 여부
|
||||
|
||||
unsigned long m_dwNextID ; // 메모리 할당시 부여되는 ID
|
||||
|
||||
unsigned long m_dwBytesAllocated ; // 할당된 메모리 바이트 수
|
||||
unsigned long m_dwBytesMaxAllocated ; // 최대로 할당된 메모리 바이트 수
|
||||
unsigned long m_dwBytesMaxChunkAllocated ; // 한번에 할당된 메모리 청크의 최대 바이트 수
|
||||
unsigned long m_dwBytesRunningTotalAllocated ; // 실행중에 할당된 메모리 바이트 총수
|
||||
unsigned long m_dwBytesFreed ; // 해제된 메모리 바이트 수
|
||||
|
||||
float m_fTimeInit ; // 초기 시간 값
|
||||
float m_fTimeMaxAllocated ; // 최대로 할당된 때의 시간
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// For timestamp
|
||||
public :
|
||||
|
||||
enum ETimestampConst
|
||||
{
|
||||
MAX_STRING_LEN = 256, // Timestamp 문자열 최대 길이
|
||||
TIMESTAMP_ALLOCATE_NUM = 32 // 기본 Timestamp 노드 할당 수
|
||||
} ;
|
||||
|
||||
struct STimestamp
|
||||
{
|
||||
char m_szString[ MAX_STRING_LEN ] ; // Timestamp 문자열
|
||||
float m_fTime ; // 시간
|
||||
|
||||
STimestamp* m_pPrev ; // Prev link
|
||||
STimestamp* m_pNext ; // Next link
|
||||
} ;
|
||||
|
||||
void AllocateTimestampBlock() ; // Timestamp node를 할당
|
||||
void DeleteTimestampBlock() ; // Timestamp node를 해제
|
||||
|
||||
STimestamp* GetFreeTimestamp() ; // 사용 가능한 Timestamp node를 반환하는 함수
|
||||
|
||||
private :
|
||||
|
||||
int m_iTimestampAllocated ; // Timestamp 가 할당된 수
|
||||
|
||||
STimestamp* m_pAvailableTimestampList ; // 사용 가능한 Timestamp 리스트
|
||||
STimestamp* m_pTimestampList ; // 할당된 Timestamp 리스트
|
||||
STimestamp* m_pTimestampEnd ; // 할당된 Timestamp 리스트 마지막 노드
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// 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="RylMemory.log", bool bFlushOnWrite=false, bool bCommitToDisk=false ) ;
|
||||
bool OpenNextLogFile() ;
|
||||
void CloseLogFile() ;
|
||||
|
||||
FILE* m_pLogFile ; // 메모리 로그 파일
|
||||
bool m_bLogFlushOnWrite ; // 메모리 로그 파일에 쓸때마다 플러쉬 여부
|
||||
bool m_bCommitToDisk ;
|
||||
char m_szLogName[ MAX_LOG_PATH ] ; // 메모리 로그 파일명
|
||||
char m_szLogBuffer[ MAX_MEMORY_LOG_OUTPUT_LENGTH ] ; // 메모리 로그 버퍼
|
||||
size_t m_WriteSize ; // 현재 로그 파일에 쓴 크기
|
||||
int m_iLogFileCounter ; // 로그 파일 인덱스 카운터
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
} ;
|
||||
|
||||
#else
|
||||
|
||||
#define GM_NEW new
|
||||
//#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__
|
||||
23
MemoryManager/GMMemory.inl
Normal file
23
MemoryManager/GMMemory.inl
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
#ifdef GM_USE_MEMORY
|
||||
|
||||
#include <cassert>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
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
|
||||
6
MemoryManager/GMRedefNew.h
Normal file
6
MemoryManager/GMRedefNew.h
Normal 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 )
|
||||
|
||||
5
MemoryManager/GMUndefNew.h
Normal file
5
MemoryManager/GMUndefNew.h
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
#undef new
|
||||
//#undef malloc
|
||||
//#undef realloc
|
||||
//#undef free
|
||||
252
MemoryManager/MemoryManager.vcproj
Normal file
252
MemoryManager/MemoryManager.vcproj
Normal file
@@ -0,0 +1,252 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="MemoryManager"
|
||||
ProjectGUID="{B6BDD524-1DDE-4A65-AED7-9EE4BC86A05D}"
|
||||
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="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="소스 파일"
|
||||
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="헤더 파일"
|
||||
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="리소스 파일"
|
||||
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>
|
||||
187
MemoryManager/MemoryManager.vcxproj
Normal file
187
MemoryManager/MemoryManager.vcxproj
Normal file
@@ -0,0 +1,187 @@
|
||||
<?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|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>{B6BDD524-1DDE-4A65-AED7-9EE4BC86A05D}</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)'=='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)'=='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)'=='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|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'" />
|
||||
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</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>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)GMMemory.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
</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)'=='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>
|
||||
42
MemoryManager/MemoryManager.vcxproj.filters
Normal file
42
MemoryManager/MemoryManager.vcxproj.filters
Normal 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>
|
||||
21
MemoryManager/ReadMe.txt
Normal file
21
MemoryManager/ReadMe.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
========================================================================
|
||||
정적 라이브러리 : MemoryManager 프로젝트 개요
|
||||
========================================================================
|
||||
|
||||
응용 프로그램 마법사에서 이 MemoryManager 라이브러리 프로젝트를 만들었습니다.
|
||||
프로젝트에 대해 소스 파일은 만들어지지 않았습니다.
|
||||
|
||||
|
||||
MemoryManager.vcproj
|
||||
응용 프로그램 마법사를 사용하여 생성한 VC++ 프로젝트의 기본 프로젝트 파일입니다.
|
||||
해당 파일을 생성한 Visual C++의 버전 정보를 비롯하여
|
||||
응용 프로그램 마법사에서 선택한 플랫폼, 구성 및
|
||||
프로젝트 기능에 대한 정보가 들어 있습니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
기타 참고:
|
||||
|
||||
응용 프로그램 마법사에서 사용하는 "TODO:" 주석은 사용자가 추가하거나 사용자 지정해야 하는
|
||||
소스 코드 부분을 나타냅니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Reference in New Issue
Block a user