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]
Other format: [Raw text]

Re: malloc attributes and realloc


 > From: Bruce Korb <bkorb@veritas.com>
 > 
 > "Kaveh R. Ghazi" wrote:
 > > 
 > >  > The claim that #3 is a poor choice is based on the (almost certainly
 > >  > correct, but not actually verified) assumption that the gains from
 > >  > this optimization are negligible. Personally I think that's a safe
 > >  > assumption (and I am dubious about the claims of significant gains in
 > >  > the malloc case).
 > > 
 > > Negligible is in the eye of the beholder.
 > > 
 > > I've done tests, described the exact parameters and posted the results
 > > in terms of GCC compile-time difference.  You're free to try any of
 > > the three experiments I did yourself and either confirm or refute my
 > > figures.  But remaining suspicious in the absence of your own legwork
 > > doesn't carry much scientific weight.
 > 
 > But remember, your tests involved gcc_malloc, not realloc.
 > I believe there is complete consensus on malloc being malloc-like. :-)
 > The issue is regarding realloc.

I know.  I did three tests:

1. Removing the attribute from gcc sources to see the existing gain:
http://gcc.gnu.org/ml/gcc/2004-01/msg00107.html
http://gcc.gnu.org/ml/gcc/2004-01/msg00116.html

2. Add the attribute to xrealloc in include/libiberty.h:
http://gcc.gnu.org/ml/gcc/2004-01/msg00160.html

3. Add the attribute to ggc.h (which slows down GCC!):
http://gcc.gnu.org/ml/gcc/2004-01/msg00163.html

I believe #2 addresses the effect of using the attribute on realloc
since GCC uses xrealloc everywhere it meant to use realloc semantics.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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