index.js
node index.js. Traces "Foo".node snapshot.json. This time does not trace "Foo".const fs = require("fs")
, path = require("path")
, v8 = require("v8")
console.log("Foo")
fs.writeFileSync(path.resolve(__dirname, "snapshot.json"), v8.getHeapSnapshot().read())
No required condition.
Output:
$ node index.js
< Foo
$ node snapshot.json
< Foo
V8 heap snapshot does not execute.
@Hydroper A heap snapshot is not a runnable representation of a program, it鈥檚 basically just a list of all JS objects that exist in memory for debugging purposes.
V8 has another feature that鈥檚 called snapshot, but Node.js currently does not support snapshotting userland code (yet).
Closing as answered.
Most helpful comment
@Hydroper A heap snapshot is not a runnable representation of a program, it鈥檚 basically just a list of all JS objects that exist in memory for debugging purposes.
V8 has another feature that鈥檚 called snapshot, but Node.js currently does not support snapshotting userland code (yet).