This should help limit our memory usage when restarting from cache.
Possible (imperfect) solution for #1027.
Please do not merge without confirming that #1027 is still an issue, and that this branch solves the problem.