void operator delete( void* iPtr ) { if ( iPtr == NULL ) return; // 引数のメモリがテーブル内に存在するか? int i = TableSearch( PointerHash(iPtr), iPtr ); if ( i == -1 ) throw Exception("確保された記録のないメモリを解放しようとしました。"); // 解放処理 free( gTable[i] ); gTable[i] = NULL; gBlockSize[i] = 0; }
void* operator new( size_t iSize ) { static int theAllocCount=0; void* thePtr = malloc( iSize ); memset( thePtr, 0xac, iSize ); // 確保したメモリを埋めておく if ( thePtr == NULL ) throw Exception("メモリが足りません。"); // 格納位置を得る int i = TableSearch( PointerHash(thePtr), NULL ); if ( i == -1 ) throw Exception("メモリブロック格納テーブルが一杯です。"); // 確保したメモリのアドレスを保持しておく gTable[i] = thePtr; gBlockSize[i] = iSize; gAllocCount[i] = theAllocCount++; return thePtr; }
/** * Type hash implementation. * * @param Ref Reference to hash * @return hash value */ uint32 GetTypeHash( const FDependencyRef& Ref ) { return PointerHash(Ref.Linker) ^ Ref.ExportIndex; }
/** Hash function required for TMap support */ uint32 GetTypeHash( const FUntypedBulkData* BulkData ) { return PointerHash(BulkData); }