Re: [patch] calling g_malloc & co via a vtable
- From: Havoc Pennington <hp redhat com>
- To: Sebastian Wilhelmi <wilhelmi ira uka de>
- Cc: Alexander Larsson <alla lysator liu se>, Gtk Development List <gtk-devel-list gnome org>
- Subject: Re: [patch] calling g_malloc & co via a vtable
- Date: 04 Oct 2000 08:34:52 -0400
Sebastian Wilhelmi <wilhelmi ira uka de> writes:
> Yes: Don't do it.
>
As noted in the previous thread, I disagree.
> 2) Implement an out-of-memory callback: What will happen? A
> g_list_.. function will call g_malloc, no memory is available, the
> callback is called, your code there decides to free a cache (being a
> GList), but the main GList mutex will be locked. Bummer. In general
> the internal state will not be consistent during a call to malloc,
> so allowing other calls from there will be a nightmare.
>
People can consider these issues and deal with them.
> BTW.: How do you implement realloc without knowing the previous allocated
> size?
>
Typically the malloc implementation stores the size in the allocated
block.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]