An image is a memory dump from a running MzScheme program that can be later restored (one or more times) to continue running the program from the point of the dump. Images are only supported for statically-linked Unix versions of MzScheme (and MrEd). There are a few special restrictions on images:
(write-image-to-file file [cont]) copies the state of the entire MzScheme process to file, replacing file if it already exists. If images are not supported, the exn:misc:unsupported exception is raised. If cont is #f, then the MzScheme or MrEd process exits immediately after creating the image. Otherwise, cont must be a procedure of no arguments, and the return value(s) of the call to write-image-to-file is (cont). The default value for cont is void.
(read-image-from-file file args) restores the image saved to file. Once the image is restored, execution of the original program continues with the return from write-image-to-file; the return value in the restored program is the a vector of strings args. A successful call to read-image-from-file never returns because the restored program is overlayed over the current program. The vector argv must contain no more than 20 strings, and the total length of the strings must be no more than 2048 characters.
If an error is encountered while reading or writing an image, the exn:misc:image exception is raised. Certain errors during read-image-from-file are unrecoverable; in case of such errors, MzScheme prints an error message and exits immediately.
An image can also be restored by starting the stand-alone version of MzScheme or MrEd with the --restore flag followed by the image filename. The return value from write-image-to-file in the restored program is a vector of strings that are the extra arguments provided on the command line after the image filename (if any).