Open deepaerial opened 1 month ago
This seems to be an issue of the env you are using to execute the javascript code.
Have you tried running node with NODE_OPTIONS=--max_old_space_size=4096
? This should raise the heap limit to avoid this kind of error.
https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory
I am pretty sure this got into the endless loop of calling while to generate the poToken, it can not generate the valid poTken -> memory leak
I have switched to node-v20.14.0-darwin-arm64
and manually run the endless loop in https://github.com/YunzheZJU/youtube-po-token-generator/blob/main/lib/task.js.
The program does not crash even if it has looped for 200+ times.
The memory usage of node keeps around 1.0GB ~ 1.2GB after some loops, while it was 500+ MB in the beginning.
However, when I switch to node 20.1.0, that decreases from >500MB to <200MB and never reached 300MB even if 200 loops is run.
So I thick that there should be no memory leak caused by myself (at least before 200 loops are reached) but there is a chance that logics from youtube's code may introduce memory leaks when it cannot generate the valid token.
And the node version may affect the memory usage, as you can see, so switching node versions may do some help.
Strangely it would output extra long poTokens in the 62th, 123th and 182th loop, which consumes a lot of time before the 63th, 124th, and 183th ones are generated.
When trying to run
one-shot.js
file fromexamples
folder I get following error:Node version:
v20.14.0