If my application runs out of memory, I would like to re-run it with changed parameters. I have `malloc` / `new` in various parts of the application, the sizes of which are not known in advance. I see two options:

* Track all memory allocations and write a restarting procedure which deallocates all before re-running with changed parameters. (Of course, I free memory at the appropriate places if no errors occur)
* Restarting the application (e.g., with `WinExec()` on Windows) and exiting

I am not thrilled by either solution. Did I miss an alternative maybe.

Thanks