g_malloc

created by tftv256
(thing) by everyone (4.1 mon) (print)   ?   (I like it!) Fri Aug 25 2000 at 21:19:39
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 www.gtk.org and not E2. :)
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.