mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 09:37:16 +08:00
Don't allocate MAX_THREADS hash tables if not necessary
This prevent crashing on mobile devices with limited RAM, currently with MAX_THREADS = 32 we would need 44MB that could be too much for a poor cellphone. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
5
src/tt.h
5
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));
|
||||
|
||||
Reference in New Issue
Block a user