mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 18:46:59 +08:00
Fix uninitialized memory usage
After increasing the number of threads, the histories were not cleared, resulting in uninitialized memory usage. This patch fixes this by clearing threads histories in Thread c'tor as is the idomatic way. This fixes issue 1227 No functional change.
This commit is contained in:
committed by
Marco Costalba
parent
7b4c9852e1
commit
e385f194e9
@@ -75,9 +75,6 @@ namespace {
|
||||
int FutilityMoveCounts[2][16]; // [improving][depth]
|
||||
int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber]
|
||||
|
||||
// Threshold used for countermoves based pruning
|
||||
const int CounterMovePruneThreshold = 0;
|
||||
|
||||
template <bool PvNode> Depth reduction(bool i, Depth d, int mn) {
|
||||
return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY;
|
||||
}
|
||||
@@ -219,16 +216,7 @@ void Search::clear() {
|
||||
TT.clear();
|
||||
|
||||
for (Thread* th : Threads)
|
||||
{
|
||||
th->counterMoves.fill(MOVE_NONE);
|
||||
th->mainHistory.fill(0);
|
||||
|
||||
for (auto& to : th->contHistory)
|
||||
for (auto& h : to)
|
||||
h.fill(0);
|
||||
|
||||
th->contHistory[NO_PIECE][0].fill(CounterMovePruneThreshold - 1);
|
||||
}
|
||||
th->clear();
|
||||
|
||||
Threads.main()->callsCnt = 0;
|
||||
Threads.main()->previousScore = VALUE_INFINITE;
|
||||
|
||||
Reference in New Issue
Block a user