On 10/6/05, Avi Bryant avi.bryant@gmail.com wrote:
How necessary is it to do the GC before a snapshot?
I doubt that anybody knows. If I had been the author of the snapshotting code, I would have included a GC from the beginning, and perhaps nobody since then would have had a reason to take it out. (If you ever have to look at an image file's internals for debugging reasons, it will be "cleaner" after a GC, for one thing.)
Is it possible to do a writeImageFile() without a GC and safely use the resulting image, or does that violate some assumptions somewhere?
An image before a GC should be just as valid as the same image after a GC. If you find otherwise, it's a bug. Nevertheless, that will be of little comfort if you find yourself struggling to reconstruct a working image on a deadline.
My advice, which probably says nothing you didn't already know, is to make a backup, carefully eyeball the snapshotting code, then give your idea a try, with lots of testing before you commit to it. I don't see why it wouldn't work, although moving the GC to happen before the fork would perhaps solve your memory thrashing problems with fewer worries.
--Tom Phoenix