Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!rutgers!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: AmigaGCC stack hogging Message-ID: <18262@cbmvax.commodore.com> Date: 29 Jan 91 19:29:25 GMT References: <1882f287.ARN1979@moria.UUCP> <1991Jan14.212254.9779@csun.edu> <18887df5.ARN1ad7@moria.UUCP> <1991Jan17.141218.19953@zorch.SF-Bay.ORG> <17766@cbmvax.commodore.com> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 34 In article jkh@bambam.pcs.com (Jordan K. Hubbard) writes: >> The problem is that GCC (and other gnu code) allocates LARGE >>amounts of memory using alloca, and holds it for a long time. For example, >>I'm told that the preprocessor or compiler pulls entire files into a > >The pre-processor does this. And it doesn't hold it that long, remember: >alloca()'d data goes away the minute the calling procedure returns. >This whole scheme works very nicely under UNIX - It's a pity that processes's >can't seem to automatically grow their stacks during run time. Why is this? Simple: how do we know that a program overran it's stack? Don't forget 1.5+ million A500's and A2000's. >I could even see a scheme where a process was halted completely and >copied to a new (larger) chunk of memory in order to "grow its stack" >if such mastication were necessary - it would still be better than >nuking it entirely. Sounds like you're talking about a VM system here... Also, what if a driver was in the process of DMAing to part of the stack? (A Read(), for example.) alloca() is NOT suited for a non-VM system. It's purpose is to implement a heap allocation scheme with heap allocation pushed off on the OS VM system. A typical Stallman-esque hack that's rather tied to a restrictive model of the system (witness GNUEmacs and tag bits for another example), and basicly a non-portable contruct. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)