Re: Minimum Stack Size

Kevan Hashemi <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Organization Brandeis University
Message-ID <[email protected]>
Thank you all for your instructions, which make perfect sense to me. As 
you say, the default stack size on MacOS is 8 MBytes, which I think 
should be enough.

I want to reach a recursion depth of around 10,000. So long as each 
recursion consumes less than 800 bytes, I'll be okay. But the program 
crashes at a depth of around 2000, which suggests tht each time the 
procedure calls itself, it uses 4 kBytes of stack space.

If you have a minute, please consider the following:

procedure recursive(i:integer);
begin
   if i<2000 then recursive(i+1);
end;

Now, if I were programming this in assembler on a 32-bit machine, I 
would push the intereger and the program counter onto the stack, using 
eight bytes. Does GPC push all registers onto the stack for a procedure 
call, and if so, can this take 4 kBytes?

Yours, Kevan


Waldek Hebisch wrote:
> Martin Liddle wrote:
>> On 26/07/2013 11:47, Waldek Hebisch wrote:
>>> Seting stack limit is mostly operating system matter and has
>>> little to do with Gpc.  On linux the ulimit command allows
>>> changing stack limit:
>>>
>>> limit -s 2048
>>>
>> Should that be ulimit -s 2048?
> 
> Yes.
> 

-- 
Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University
http://alignment.hep.brandeis.edu/

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.