GNOME Bugzilla – Bug 168417
g_malloc/malloc0/realloc OOM handling
Last modified: 2013-02-03 01:48:51 UTC
I think it would be nice to call g_blow_chunks() when system is out of memory, instead of re-throwing malloc/calloc/realloc failure.
If you want to go in that direction, it would probably be a good idea to add a way to register a blow_caches() function, so that apps get a chance to shrink application-level caches at the same time.
I'd like g_malloc to be a bit smarter that standard malloc: do its best before crashing. What about g_try_malloc/g_try_realloc : should they also try to release some memory before returning NULL ? Registering blow_cache() functions sounds good, but i don't know whether or not user should be able to manually blow_all_registred_caches().
Created attachment 38418 [details] [review] proposed patch simple patch without the ability to register cleanup functions.
We should probably wait for the outcome of the discussion in bug 118439 before doing anything here. Maybe blow_chunks() will be irrelevant after that...
closing out some old bugs