Re: glib memory allocation problems



Dimitrios Apostolou wrote:

I don't understand some things however, so here are some questions to glib devs: 1) Why the crash didn't occur when using G_SLICE=always-malloc?

IANA glib dev.
I believe when G_SLICE=always-malloc, the g_slice allocators are simplified to something like:

    g_slice_alloc(block_size) becomes malloc(block_size)
    g_slice_free(type, mem)   becomes free(mem)

and when -lpthread is used, thread-safe versions of malloc/free are linked in by the compiler. So, no crash since the memory allocators were thread safe.

-brandon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]