This is the mail archive of the cygwin 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: BUG: alternatives


Charles Wilson wrote:

> Revised patch attached.  I'm wondering, tho, about the advisability of
> using alloca'ed (rather than malloc'ed) memory to hold the contents of a
> file of unrestricted size.  Aren't there limits on the available space
> within a single stack frame?  Does it make sense (is it legal) to alloca
> 40k or 50k or 500k? of memory?

It doesn't sound like the greatest idea in the world.  If you try to
alloca() more than what's available on the stack you get a SEGV or
similar, and there's no way to check for success/failure other than just
hoping that it doesn't happen, afaik.

On the other hand, as long as the program doesn't have a lot of
recursion 50k ought to be no problem at all.  I think the default on
win32 (-Wl,--stack) is 2MB, which of course not all of which would be
available but is still >> 50k.

So I guess it just depends on how much time you want to spend making
this "technically correct" in the face extremely large files, which
would seem pretty rare to me.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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