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:
Marco Costalba
2011-04-24 19:23:07 +01:00
parent fecefbb99c
commit 339e1b49f6
5 changed files with 40 additions and 19 deletions
+5 -2
View File
@@ -435,15 +435,18 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) {
UCIMultiPV = Options["MultiPV"].value<int>();
SkillLevel = Options["Skill level"].value<int>();
ThreadsMgr.read_uci_options();
read_evaluation_uci_options(pos.side_to_move());
ThreadsMgr.read_uci_options();
// If needed allocate pawn and material hash tables and adjust TT size
ThreadsMgr.init_hash_tables();
TT.set_size(Options["Hash"].value<int>());
if (Options["Clear Hash"].value<bool>())
{
Options["Clear Hash"].set_value("false");
TT.clear();
}
TT.set_size(Options["Hash"].value<int>());
// Do we have to play with skill handicap? In this case enable MultiPV that
// we will use behind the scenes to retrieve a set of possible moves.