mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 01:56:58 +08:00
Start a TT resize only after search finished.
As noticed in the forum, a crash in extract_ponder_from_tt could result if hash size is set before the ponder move is printed. While it is arguably a GUI issue (but it got me on the cli), it is easy to avoid this issue. Closes https://github.com/official-stockfish/Stockfish/pull/1856 No functional change.
This commit is contained in:
committed by
Stéphane Nicolet
parent
4f3804f3f3
commit
fda0161e3a
@@ -136,10 +136,10 @@ void ThreadPool::set(size_t requested) {
|
|||||||
while (size() < requested)
|
while (size() < requested)
|
||||||
push_back(new Thread(size()));
|
push_back(new Thread(size()));
|
||||||
clear();
|
clear();
|
||||||
}
|
|
||||||
|
|
||||||
// Reallocate the hash with the new threadpool size
|
// Reallocate the hash with the new threadpool size
|
||||||
TT.resize(Options["Hash"]);
|
TT.resize(Options["Hash"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ThreadPool::clear() sets threadPool data to initial values.
|
/// ThreadPool::clear() sets threadPool data to initial values.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "bitboard.h"
|
#include "bitboard.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "thread.h"
|
||||||
#include "tt.h"
|
#include "tt.h"
|
||||||
#include "uci.h"
|
#include "uci.h"
|
||||||
|
|
||||||
@@ -58,6 +59,8 @@ void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) {
|
|||||||
|
|
||||||
void TranspositionTable::resize(size_t mbSize) {
|
void TranspositionTable::resize(size_t mbSize) {
|
||||||
|
|
||||||
|
Threads.main()->wait_for_search_finished();
|
||||||
|
|
||||||
clusterCount = mbSize * 1024 * 1024 / sizeof(Cluster);
|
clusterCount = mbSize * 1024 * 1024 / sizeof(Cluster);
|
||||||
|
|
||||||
free(mem);
|
free(mem);
|
||||||
|
|||||||
Reference in New Issue
Block a user