This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using ggc-page with plain malloc


Wolfram Gloger wrote:
> A memalign() emulation via malloc() is certainly the most portable
> solution, however using it a lot (for, e.g. allocating a single page)
> is a dead-sure method for fragmenting the heap badly.

The solution is to allocate, say, 50 * page size, align to page size,
and stuff the 49 aligned pages into your list of free pages.

Not much wastage then.

> I would suggest to use anonymous mmap() or mmap() on /dev/zero
> (whereever one of those is available) to obtain pages of memory.

That's always the first option.  And you shouldn't allocate 1 page at a
time with those either.

-- Jamie

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]