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: Reducing memory consumption



  In message <200003192042.VAA00809@loewis.home.cs.tu-berlin.de>you write:
  > > go look at how valloc works when you ask for a page of memory :(. 
  > 
  > You are talking about BSD valloc here, right? Which is
  > 
  > void *
  > valloc(i)
  >         size_t i;
  > {
  >         long valsiz = getpagesize(), j;
  >         void *cp = malloc(i + (valsiz-1));
  > 
  >         j = ((long)cp + (valsiz-1)) &~ (valsiz-1);
  >         return ((void *)j);
  > }
Right.  Now go peek at how malloc handles a 2 * pagesize - 1 byte request
and start crying...  Ugh, I forgot both valloc & malloc add their own
(significant) overhead to these kinds of requests.

  > So perhaps it is not a good idea to use valloc, then, and instead
  > allocate more than one page at a time using malloc?
Possibly.  Alexandre has a patch which does this I think and I'm
planning to try it next time I try to bootstrap the m68k port on my
BSD boxes.

jeff



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