hi-ogawa/Stockfish

Clear memory, terminate worker

Opened this issue · 2 comments

Hi,

Is there a way to free the memory used by stockfish when we're done using it?

Here is what I tried:

const worker = window['Stockfish']({ wasmBinary });
// some logic
worker.postMessage('stop');
worker = undefined;

Thanks !

Not sure if this will help, but as someone who's worked on front ends using UCI directly I would use 'uci' or better 'ucinewgame' that is supposed to force the engine to free all memory for the new game. Good luck!

Unfortunately, no. ucinewgame clears hashtables amongst other things, but does not deallocate them.