Re: [patch] calling g_malloc & co via a vtable



Alexander Larsson <alla lysator liu se> writes: 
> Ok. How about this:
> * Add a vtable based malloc, realloc, try_alloc, try_realloc, free
>   implementation to glib
> * rip out dmalloc support (Borken anyay)

Yep.

> * rip out the memory profiler/checker (Can be done using a vtable)
>

Or better, put in a more useful profiler (well, it will already be
more useful if you don't have to rebuild glib to use it...)
 
> And, optionally, if the maintainers think it's suitable:
> * Add a memory pressure callback. With suitable comments in the code 
>   explaining the problems this can cause if used improperly ("Here be
>   dragons")

I don't think you can have a generic one (people have to keep up with
their own list of stuff they can free). Or if you mean just a function
to be called by the default malloc(), I think it's better to just let
people replace the default malloc.

> * Add cache flushers in glib and gtk that can be called when there is 
>   memory pressure
> 

Yep. Or as Tim suggested, have a setting for low-memory apps where
GList, etc. don't use the mem chunks.

Havoc




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