Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/