Engines use all available memory

Discussion of chess software programming and technical issues.

Moderator: Ras

MOBMAT
Posts: 396
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Engines use all available memory

Post by MOBMAT »

while searching for mates using various engines, I notice that even if I set the size of the hash to a reasonable (half of the available memory), some engines, over time will slowly use up all the available memory resources.

Is this caused by other non-hash internal memory allocations or perhaps a memory leak unknown to the authors?

Have others noticed this?

The latest culprit of this is "The Huntsman", which is a Stockfish clone. I haven't yet checked to see if this behavior is limited to only Stockfish clones.

Vince
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
MOBMAT
Posts: 396
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Re: Engines use all available memory

Post by MOBMAT »

Upon further review, it appears the cause of the creeping memory use is associated with the Syzygy tables. When I disable them in a search, the memory usage remains stable.

I haven't looked at the source code for the Syzygy interface, but I'm guessing it keeps a file handle open for each table file it needs. So, until all possible endgame files are opened, the memory will continue to be allocated by the OS with each new file open request.

So, that begs the question, what is the worse case scenario?

I have the 6-man tables on an SSD. That is over 1000 files. Does the Syzygy code actually allow for all 1000 to be opened during a search?
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Engines use all available memory

Post by yurikvelo »

Do you use Syzygy?

is it stockfish**.exe process consuming RAM or any other row in Task Manager?
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Engines use all available memory

Post by yurikvelo »

MOBMAT wrote: Sun Feb 12, 2023 12:30 pm the memory usage remains stable.
operating system buffers HDD I/O

https://groups.google.com/g/fishcooking/c/kto46FKCGgo