You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create a stockfish() instance for each game on my server (nodejs), the memory was growing larger and larger when opening new games, but didn't go down when a game was destroyed.
I made a small experiment:
const stockfish = require('stockfish')
const readline = require('readline')
let s = null
const rl = readline.createInterface(process.stdin, process.stdout)
rl.setPrompt('> ')
rl.prompt()
rl.on('line', line => {
rl.prompt()
s = stockfish()
s.onmessage = line => {
console.log(line)
}
s.postMessage('quit')
s.onmessage = null
s = null
global.gc()
}).on('close', () => {
process.exit(0)
})
Each time I press enter, the memory increases by ~30MB, the memory doesn't go down even if I do manual GC (node --expose-gc test.js), sending quit command does not work either.
The text was updated successfully, but these errors were encountered:
Hey,
Not sure if you are still stuck on this problem but if anyone else is having a similar issue then you can try putting the stockfish function in a workerpool worker thread and terminating it after you are done using that particular stockfish instance.
I create a
stockfish()
instance for each game on my server (nodejs), the memory was growing larger and larger when opening new games, but didn't go down when a game was destroyed.I made a small experiment:
Each time I press enter, the memory increases by ~30MB, the memory doesn't go down even if I do manual GC (
node --expose-gc test.js
), sendingquit
command does not work either.The text was updated successfully, but these errors were encountered: