This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
RE: stack overflow bug in ofstream::operator<<
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Dave Korn <dave dot korn at artimi dot com>
- Cc: cygwin-developers at cygwin dot com
- Date: Tue, 28 Jun 2005 16:31:08 -0400 (EDT)
- Subject: RE: stack overflow bug in ofstream::operator<<
- References: <SERRANOmCPfObkhpi8E00000279@SERRANO.CAM.ARTIMI.COM>
- Reply-to: cygwin-developers at cygwin dot com
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