Re: g_malloc overhead



On Tue, Jan 20, 2009 at 12:48 PM, Larry Reaves <larry yrral net> wrote:
On Tue, 2009-01-20 at 09:01 +0100, MartÃn Vales wrote:
BJÃrn Lindqvist escribiÃ:
Actually, a custom allocator could be useful even in the general case.
Malloc is a system call and has quite bad performance on certain
platforms (windows in particular i think). Something like the gslice
allocator could
Probably improve performance a bit.

gslice i believe use malloc internally. I believe you always need
malloc/new-(C/C++) because you depend on ms Windows API.

I am not sure if you can build your own malloc because you depend on the
operating system.
Sure, you must malloc to get new memory, but you can malloc bigger than
what you need and hand out the extra memory later at a much lower cost.

I recall reading somewhere that mmap can be used to build custom
memory allocators. If that's true than one can bypass malloc. I think
that you can request memory through mmap by using MAP_ANONYMOUS.

Emmanuel Rodriguez


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