Some aspect of GCC memory consumption increased by recent patch

Jan Hubicka jh@suse.cz
Wed Sep 29 11:08:00 GMT 2004


> Ben Elliston wrote:
> >Jan Hubicka <jh@suse.cz> writes:
> >
> >
> >>up to 3% memory consumption increase looks pretty serious even
> >>tought we save some memory on generate-3.4.ii.  Is there some
> >>understanding why it happens and/or some hope that it will get
> >>solved?
> >
> >
> >I spent a bit of time thinking about this today.
> >
> >Nathan, is it possible that the pre-allocation strategy for the
> >type-safe vectors is causing a higher than usual peak in memory
> >consumption?  I note that vec.h says "Reallocation causes an
> >exponential increase in vector size."
> 
> yeah, I talked with Honza on IRC about this.  I don't think the exponential
> increase is the problem.  There are two other issues.
> 
> 1) The default length is 4 slots.  As most blocks only have 1 or 2 edges,
> that is probably wrong.  I'd guess 2 would be a better default.  It's not
> obvious to me as to whether _most_ blocks have 1 exit, or 2 exits.  I 
> suspect
> that defaulting to 1 is too conservative.

I tested both.  For 4 we get 201324716 of garbage and 8022858 ggc calls,
for 2 we get 200259952 and 8034381 ggc calls, for 1 we get 199828592 and
8073775 ggc calls.  In combination with ggc_free on the vectors in
expunge_blocks we get 198573736 and 8073613 ggc calls.

Originaly we needed 197495132 bytes and 7876525 ggc calls.

Honza
> 
> 2) The length and alloc members are 32bits, they need not be.  I think
> I should make them default to 'unsigned short', thereby removing 1 word
> from a vector.  This extra size is someting that's causing Geoff Keating not
> to want to use them for an attribute mechanism rewrite.  For vectors
> which could get really long, we'd have yet another definition macro 
> (bleah!).
> 
> It'd have to be something like DEF_LONG_VEC_{GC,MALLOC}_{P,O}.  Do you all
> think the LONG bit should be part of use too (i.e. allow LONG_VEC(thing) and
> VEC(thing)).  It seems to me that that would be the right thing.
> 
> IIRC, the old structure contained three words per edge (next, prev and 
> edge),
> thus a vector defaulting to 4 slots (6words), would only be a saving if the
> average number of edges per block was >= 2.
> 
> Can you experiment with reducing the default allocation size? It's contained
> in vec.c.
> 
> BTW, is forwarding the memory usage info from the point of call of the 
> vector
> api functions the right thing? (Rather than merely indicate the vector API
> function itself?)
> 
> nathan
> 
> -- 
> Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
> nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk
> 
> 



More information about the Gcc-regression mailing list