memory: move preallocation code out of exec.c