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
The following script crashes when the garbage collector is run, without throwing an exception.
(run with --expose-gc)
constweak=require('weak');// Never calledprocess.on('uncaughtException',(ex)=>{console.error("Uncaught exception: ",ex);});// Keep alivesetInterval(()=>null,1000);functionfoo(){this.bar=5};varstrongFoo=newfoo();varweakFoo=weak(strongFoo,()=>{console.log("Foo is rip: ",weakFoo);});console.log("weakFoo before GC: ",weakFoo);strongFoo=null;global.gc();console.log("weakFoo after GC: ",weakFoo);
results in the following when running node wrapped using nodemon:
weakFoo before GC: foo { bar: 5 }
[nodemon] app crashed - waiting for file changes before starting...
running with node directly immediately exits after the before GC statement is printed.
Node does not crash during the after GC statement if you bypass the callback by removing the reference to 'weakFoo'.
Expected behavior.
Node does not crash unexpectedly, or throws an exception when an unsafe reference to a weak variable is made inside of the variables' callback.
The text was updated successfully, but these errors were encountered:
Issue
The following script crashes when the garbage collector is run, without throwing an exception.
(run with --expose-gc)
results in the following when running node wrapped using nodemon:
running with node directly immediately exits after the
before GC
statement is printed.Node does not crash during the
after GC
statement if you bypass the callback by removing the reference to 'weakFoo'.Expected behavior.
Node does not crash unexpectedly, or throws an exception when an unsafe reference to a weak variable is made inside of the variables' callback.
The text was updated successfully, but these errors were encountered: