glib's wrapper to malloc. If the malloc fails, your program will terminate and print an error message. This is good because you don't have to bother to check the return code, but also bad in a way: just because you fail a libc call doesn't always mean you should quit the program all together. Then again, if you fail a malloc, you're probably out of memory, so I guess that's a Good Thing.

There's also g_free and g_malloc0. g_free is like free(), and g_malloc0 does a g_malloc and then sets the returned memory's contents to zeroes.

If you're really all that interested in this, you should probably be reading the glib documentation at and not E2. :)

Log in or register to write something here or to contact authors.