Skip to content

Commit 106f217

Browse files
authored
[GEN][ZH] Fix assertion errors on game launch with MEMORYPOOL_INTENSE_VERIFY (#1276)
1 parent 9c8b539 commit 106f217

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,16 +899,17 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo
899899
#ifdef MEMORYPOOL_CHECKPOINTING
900900
m_checkpointInfo = NULL;
901901
#endif
902-
#ifdef MEMORYPOOL_BOUNDINGWALL
903-
m_wallPattern = theBoundingWallPattern++;
904-
debugFillInWalls();
905-
#endif
906902

907903
m_nextBlock = NULL;
908904
#ifdef MPSB_DLINK
909905
m_prevBlock = NULL;
910906
#endif
911907
m_owningBlob = owningBlob; // could be NULL
908+
909+
#ifdef MEMORYPOOL_BOUNDINGWALL
910+
m_wallPattern = theBoundingWallPattern++;
911+
debugFillInWalls();
912+
#endif
912913
}
913914

914915
//-----------------------------------------------------------------------------
@@ -1056,9 +1057,13 @@ void MemoryPoolSingleBlock::debugVerifyBlock()
10561057
DEBUG_ASSERTCRASH(m_debugLiteralTagString != NULL, ("bad tagstring"));
10571058
/// @todo Put this check back in after the AI memory usage is under control (MSB)
10581059
//DEBUG_ASSERTCRASH(m_logicalSize>0 && m_logicalSize < 0x00ffffff, ("unlikely value for m_logicalSize"));
1059-
DEBUG_ASSERTCRASH(!m_nextBlock || m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
1060+
DEBUG_ASSERTCRASH(m_nextBlock == NULL
1061+
|| memcmp(&m_nextBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
1062+
|| m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10601063
#ifdef MPSB_DLINK
1061-
DEBUG_ASSERTCRASH(!m_prevBlock || m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
1064+
DEBUG_ASSERTCRASH(m_prevBlock == NULL
1065+
|| memcmp(&m_prevBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
1066+
|| m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10621067
#endif
10631068
debugCheckUnderrun();
10641069
debugCheckOverrun();

GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -881,16 +881,16 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo
881881
m_checkpointInfo = NULL;
882882
#endif
883883

884-
#ifdef MEMORYPOOL_BOUNDINGWALL
885-
m_wallPattern = theBoundingWallPattern++;
886-
debugFillInWalls();
887-
#endif
888-
889884
m_nextBlock = NULL;
890885
#ifdef MPSB_DLINK
891886
m_prevBlock = NULL;
892887
#endif
893888
m_owningBlob = owningBlob; // could be NULL
889+
890+
#ifdef MEMORYPOOL_BOUNDINGWALL
891+
m_wallPattern = theBoundingWallPattern++;
892+
debugFillInWalls();
893+
#endif
894894
}
895895

896896
//-----------------------------------------------------------------------------
@@ -1038,9 +1038,13 @@ void MemoryPoolSingleBlock::debugVerifyBlock()
10381038
DEBUG_ASSERTCRASH(m_debugLiteralTagString != NULL, ("bad tagstring"));
10391039
/// @todo Put this check back in after the AI memory usage is under control (MSB)
10401040
//DEBUG_ASSERTCRASH(m_logicalSize>0 && m_logicalSize < 0x00ffffff, ("unlikely value for m_logicalSize"));
1041-
DEBUG_ASSERTCRASH(!m_nextBlock || m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
1041+
DEBUG_ASSERTCRASH(m_nextBlock == NULL
1042+
|| memcmp(&m_nextBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
1043+
|| m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10421044
#ifdef MPSB_DLINK
1043-
DEBUG_ASSERTCRASH(!m_prevBlock || m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
1045+
DEBUG_ASSERTCRASH(m_prevBlock == NULL
1046+
|| memcmp(&m_prevBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
1047+
|| m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10441048
#endif
10451049
debugCheckUnderrun();
10461050
debugCheckOverrun();

0 commit comments

Comments
 (0)