0

I was trying to use snapshot utility in V8 to speed up my application startup performence. As it is pointed out in the V8 blog, using snapshot makes it possible to skip over the startup time incurred by some initialization.

StartupData snapshotDataBlob = V8::CreateSnapshotDataBlob(myScript);

I used CreateSnapshotDataBlob to create a snapshot, and I got snapshotDataBlob.data == NULL, which means a failure.

So my question is, under what circumstances will CreateSnapshotDataBlob failed?

  • are you using a trycatch to catch an exception and then print it out? Also, one reason I've seen this fail recently is that you can't have any Persistent/Global objects outstanding when you take the snapshot. – xaxxon Sep 25 '17 at 08:10

1 Answers1

0

CreateSnapshotDataBlob will fail if your script runs into any kind of error or uncaught exception.

jmrk
  • 34,271
  • 7
  • 59
  • 74
  • I previously used `ScriptCompiler::Compile()` and `Run()` to handle the same script and it worked well, so I don't think there is any kind of error or uncaught exception in my script. – Mitchell Cai Sep 24 '17 at 05:41