From mint-bounce@lists.fishpool.fi  Thu Feb 19 04:48:13 2009
Cc: mint <mint@fishpool.com>
Message-Id: <F888192C-EA2B-47E6-9525-D76881ACFBED@seznam.cz>
From: Standa Opichal <opichals@seznam.cz>
To: Mark Duckworth <mduckworth@atari-source.org>
In-Reply-To: <499C966D.4020204@atari-source.org>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v930.3)
Subject: Re: [MiNT] Default Stack Size
Date: Thu, 19 Feb 2009 10:44:43 +0100
References: <499C82B4.6060005@atari-source.org> <499C944D.7090404@freesbee.fr> <499C966D.4020204@atari-source.org>
X-Mailer: Apple Mail (2.930.3)
X-Smtpd: 1.1.4@13901
X-Seznam-User: opichals@seznam.cz
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-to: mint-bounce@lists.fishpool.fi
X-original-sender: opichals@seznam.cz
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>

Hi Mark! :)

> That's why I suggested the binutils make a sane default but really I  
> don't know what a sane default is.  I never really thought a program  
> would need more than 64KB of stack space but G++ easily proves me  
> wrong ;)  I guess I think small ;)

IMO there is simply no sane default. Current Linux application code  
bases (the ones that are being ported to FreeMiNT) do not care about  
the stack size and easily contain for example functions like the one  
below. It is extremely easy to consume a stack of any size today.

Therefore the only viable solution is to build dynamically expanding  
stack capabilities into the kernel.

STanda


------------ Cut ----------

// should consume approx 4kB per call.
int recursiveStackHog( int n ) {
	long buffer[1024];
         // ... do something
         if ( n <= 0 ) return 0;

	return recursiveStackHog( n - 1);
}


