On 01/26/2011 03:23 PM, Stefan Hajnoczi wrote:
Both g_malloc() and g_try_malloc() are available where g_try_malloc() returns NULL on failure. g_malloc() matches qemu_malloc() exit behavior today but in the future it would be possible to use g_try_malloc() for proper out-of-memory handling. But I think you're pointing out that glib uses g_malloc() internally. That is a design flaw and basically makes g_try_malloc() useless.
No. glib cannot be used for applications that want to handle malloc() robustly.
But I've never met an application that does so it doesn't really bother me. Regards, Anthony LIguori
Stefan