mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Free Tablebases before to exit
Fix valgrind errors.
This commit is contained in:
parent
7bc5946fc9
commit
a14fa77ede
3 changed files with 10 additions and 3 deletions
|
@ -41,12 +41,13 @@ int main(int argc, char* argv[]) {
|
|||
Search::init();
|
||||
Eval::init();
|
||||
Pawns::init();
|
||||
Threads.init();
|
||||
Tablebases::init(Options["SyzygyPath"]);
|
||||
TT.resize(Options["Hash"]);
|
||||
Threads.init();
|
||||
|
||||
UCI::loop(argc, argv);
|
||||
|
||||
Threads.exit();
|
||||
Tablebases::free();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1776,7 +1776,7 @@ WDLScore probe_ab(Position& pos, WDLScore alpha, WDLScore beta, int *success)
|
|||
|
||||
} // namespace
|
||||
|
||||
void Tablebases::init(const std::string& paths)
|
||||
void Tablebases::free()
|
||||
{
|
||||
for (int i = 0; i < TBnum_piece; ++i)
|
||||
free_wdl_entry(&TB_piece[i]);
|
||||
|
@ -1794,6 +1794,12 @@ void Tablebases::init(const std::string& paths)
|
|||
|
||||
TBnum_piece = TBnum_pawn = 0;
|
||||
MaxCardinality = 0;
|
||||
}
|
||||
|
||||
void Tablebases::init(const std::string& paths)
|
||||
{
|
||||
|
||||
Tablebases::free();
|
||||
TBPaths = paths;
|
||||
|
||||
if (TBPaths.empty() || TBPaths == "<empty>")
|
||||
|
@ -2373,4 +2379,3 @@ bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Val
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ enum WDLScore {
|
|||
extern int MaxCardinality;
|
||||
|
||||
void init(const std::string& paths);
|
||||
void free();
|
||||
WDLScore probe_wdl(Position& pos, int* success);
|
||||
int probe_dtz(Position& pos, int* success);
|
||||
bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score);
|
||||
|
|
Loading…
Add table
Reference in a new issue