- - Never use g_malloc() or g_malloc0(). These functions do not return NULL
- if not enough memory is available but rather lead to an exit() or segfault
- instead. This behaviour is not acceptable for libraries.
- Use g_try_malloc()/g_try_malloc0() instead and check the return value.
+ - We assume that "small" memory allocations (< 1MB) will always succeed.
+ Thus, it's fine to use g_malloc() or g_malloc0() for allocations of
+ simple/small structs and such (instead of using g_try_malloc()), and
+ there's no need to check the return value.
+
+ Do use g_try_malloc() or g_try_malloc0() for large (>= 1MB) allocations
+ and check the return value.