Re: [gtk-list] GAllocator vs. g_free (was: GMemChunk for skip lists)
- From: Havoc Pennington <hp redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] GAllocator vs. g_free (was: GMemChunk for skip lists)
- Date: 09 Mar 2000 16:38:57 -0500
Derek Simkowiak <dereks@kd-dev.com> writes:
> I have recently learned that free() (or g_free() ) does not return
> the freed memory to the operating system until after the program is
> killed. So if I g_malloc() a ton of memory, and then g_free() it, my
> program is still using a crapload of RAM until it is killed.
>
> Is it any different with a GAllocator? I.e., if I need to
Yes, because mem chunks can only be recycled for allocations of the
same type/size, while memory allocated by malloc() can be recycled for
any future malloc(). This is why mem chunks are theoretically faster,
because you can simply pop the top free chunk off a stack, instead of
trying to find a free chunk of the right size. However in practice GNU
libc malloc() can find a free chunk about as fast as glib's mem chunk
stuff can, because GNU libc malloc() is an insanely scary
hyperoptimized thing.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]