This is the mail archive of the gcc-patches@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: malloc-based ggc-page


On Jan 18, 2000, Geoff Keating <geoffk@cygnus.com> wrote:

> Alexandre Oliva <oliva@lsd.ic.unicamp.br> writes:

>> Isn't ggc-page in error attempting to free() the value returned by
>> valloc()?

> Yes, it is.  The GNU libc documentation says:

>    With the GNU library, you can use `free' to free the blocks that
> `memalign' and `valloc' return.  That does not work in BSD,
> however--BSD does not provide any way to free such blocks.

It appears to work on Solaris too, despite the documentation.  I have
found it out while trying to figure out a test to decide whether
valloc()ed addresses can be free()d.  I couldn't find any system in
which rather elaborate tests would fail :-(

OTOH, I could confirm my theory that, if we allocate a few bytes less
than the page size, we can get contiguous pages from valloc(), without
wasting every other page.  The patch I had posted already attempted to
figure out how many bytes we had to give up per page, but it did it
only for malloc.  I was surprised to find out the number of bytes was
not the same when using valloc().

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


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