delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/06/15:20:23

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <436E657D.16336C2@dessent.net>
Date: Sun, 06 Nov 2005 12:20:13 -0800
From: Brian Dessent <brian AT dessent DOT net>
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: BUG: alternatives
References: <436CF5E9 DOT 30106 AT cwilson DOT fastmail DOT fm> <001201c5e244$c9e50490$020aa8c0 AT DFW5RB41> <436D9993 DOT 7050100 AT cwilson DOT fastmail DOT fm> <20051106134339 DOT GA24549 AT trixie DOT casa DOT cgf DOT cx> <436E50DE DOT 3070405 AT cwilson DOT fastmail DOT fm>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019