Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 #1856

No functional change.
  • Loading branch information
vondele authored and snicolet committed Dec 16, 2018
1 parent 4f3804f commit fda0161
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/thread.cpp
Expand Up @@ -136,10 +136,10 @@ void ThreadPool::set(size_t requested) {
while (size() < requested)
push_back(new Thread(size()));
clear();
}

// Reallocate the hash with the new threadpool size
TT.resize(Options["Hash"]);
// Reallocate the hash with the new threadpool size
TT.resize(Options["Hash"]);
}
}

/// ThreadPool::clear() sets threadPool data to initial values.
Expand Down
3 changes: 3 additions & 0 deletions src/tt.cpp
Expand Up @@ -24,6 +24,7 @@

#include "bitboard.h"
#include "misc.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"

Expand Down Expand Up @@ -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) {

Threads.main()->wait_for_search_finished();

clusterCount = mbSize * 1024 * 1024 / sizeof(Cluster);

free(mem);
Expand Down

0 comments on commit fda0161

Please sign in to comment.