Re:Show HN: Progressbar - A C library for displaying command...
by dalke on Saturday August 29, 2015 @04:33AM
(#10139444)
Another is to pre-allocate enough reserve memory to be able to save and exit cleanly. When malloc fails, switch to the reserve memory and either shut down nicely, or post a dire warning to the user that the end is neigh and to "SAVE AND EXIT IMMEDIATELY".
e.g. https://github.com/git/git/blob/master/wrapper.c#L63