Don't allocate MAX_THREADS hash tables if not necessary
[stockfish] / src / tt.h
index a4ccd8be122d42d04603af957c81756ec224cde8..69cdad0c17dc19f19d351a36e0b79faf5e696700 100644 (file)
--- a/src/tt.h
+++ b/src/tt.h
@@ -148,11 +148,14 @@ struct SimpleHash {
 
   void init() {
 
+    if (entries)
+        return;
+
     entries = new (std::nothrow) Entry[HashSize];
     if (!entries)
     {
         std::cerr << "Failed to allocate " << HashSize * sizeof(Entry)
-                  << " bytes for material hash table." << std::endl;
+                  << " bytes for hash table." << std::endl;
         exit(EXIT_FAILURE);
     }
     memset(entries, 0, HashSize * sizeof(Entry));