This is the mail archive of the cygwin-developers mailing list for the Cygwin 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: stack overflow bug in ofstream::operator<<


On Tue, 28 Jun 2005, Dave Korn wrote:

> ----Original Message----
> >From: Igor Pechtchanski
> >Sent: 28 June 2005 19:10
>
>   Ok, I'm following you up to this point ...
>
> >  Checking the stack size every time will introduce equal
> > overhead on both paths,
>
>   ... but now you've lost me.  How does checking the stack space make the
> alloca path take as long as the malloc path?

That's "equal overhead *on top* of the alloca/malloc costs".

> > but I'm not sure we can do better (besides, the overhead should be
> > pretty small -- a memory read followed by a pointer comparison).
>
>   Umm, this is all completely lost in the noise next to the difference in
> execution times between malloc and alloca isn't it?

It is for malloc.  Alloca is cheap enough that this may be noticeable.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT


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