I believe that if I can store the entire state of the application as it lives on the memory space of the process running the java virtual machine, then I should also be able to create a new java process and replace its memory contents with the state saved in the image file.

It's my theory that If I do this, I can start my application several seconds faster, it'd be as fast as I could read the file and put it in the right memory zone(s) of the jvm.

Two issues - First some of that startup code will allocate operating system objects that will be missing when you try to restart. Second both Windows and Linux use ASLR (Address Space Layout Randomization) for security. There is no guarantee the same virtual addresses will be free for 2 runs of a process.
–
brian beuningDec 2 '12 at 18:13

1 Answer
1

You can use serialization to write the state of the application (beware of cycles in the object graph, though), and then deserialize it on startup, but that's not quite the same as creating an image of the JVM process. You'll still need to load the classes and instanciate some basic infrastructure to bootstrap the application, and you won't be in the same state memory- and JIT-wise. The JVM abstracts a lot of things from you, so you don't have access to "the right memory zone(s)".

Whether it will have a positive impact on the application's startup time really depends on where the state is initially loaded from and how much it costs to build, anyway.