Subject: [clisp-list] Program stack overflow. RESET: how to increase the stack size on windows?

From: Christian Schuhegger <[email-masked]>
Date: Thu Jun 6 07:17:08 2002

hello,

i just ran into a problem:
*** Program stack overflow. RESET

i found the following mail (see below) on the clisp-list. i am working 
on windows and i would like to increase the stack size of the lisp.exe 
executable. now i wonder how to do this?

can anybody give me a hint?

many thanks!

 > FROM: Bruno Haible
 > DATE: 09/29/2000 05:57:58
 > SUBJECT: RE:  [clisp-list] Lisp and Memory-- "Program Stack Overflow"
 >
 >
 >
 > Justice, Randy writes:
 >
 >>>I trying to do some recursive memory searches.  I have run into a 
couple of
 >>
 >>searches which require large amounts of memory.  I understand that 
CLISP has
 >>an option of -m to allocate more memory.
 >>
 >>>On the NT side, It does not seem to work at all.  On NT, I get about 
2000
 >>
 >>levels down before "Program Stack Overflow. RESET" regardless of the 
value
 >>by option -m.
 >>
 >>>RedHat Linux seem to have a limit too.  The -m10m gives me about 8000
 >>
 >>levels, -m20m gives me about 9500 levels,  and -m40m has the same 
limit as
 >>-m20m.
 >>
 >>>How do I get more memory of CLISP to use?  Or is there a bigger 
concept that
 >>
 >>I am missing?
 >
 >
 > CLISP cannot give you more than the default stack size of the
 > operating system, because the operating system generally doesn`t allow
 > it. On Windows, the stack size needed by a program must be hardwired
 > in the executable (lisp.exe). On Unix, the maximum stack size is
 > changeable through the `ulimit` shell builtin; its use might require
 > superuser privileges.
 >
 > Therefore all you can do is
 >   a) prefer iteration over recursion when you are iterating through
 >      long lists,
 >   b) compile your lisp programs, then they eat less stack,
 >   c) become superuser and use "ulimit -s" to change the stack size,
 >      then su back to your normal identity and start clisp.
 >
 > Bruno

-- 
--
Christian Schuhegger

---

From: Sam Steingold <[email-masked]>
Date: Thu Jun 6 07:43:03 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Program stack overflow. RESET: how to increase the stack size on windows?"
> * Sent on Thu, 06 Jun 2002 16:16:19 +0200
> * Honorable Christian Schuhegger <[email-masked]> writes:
>
> i am working on windows and i would like to increase the stack size of
> the lisp.exe executable. now i wonder how to do this?

editbin /stack:3145728 lisp.exe

3145728 is the default value.
increase it to your taste.
note that editbin.exe does not come with MS "OS"es, only with their
"development systems", so you will have to find someone with "MSVS" to
do this.

note that compiling program will save stack too.
also, nothing beats algorithm improvement. :-)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
MS Windows: error: the operation completed successfully.

---

From: Arseny Slobodjuck <[email-masked]>
Date: Fri Jun 7 05:00:03 2002

Hello Christian,

Friday, June 07, 2002, 12:16:19 AM, you wrote:

Christian> i just ran into a problem:
Christian> *** Program stack overflow. RESET

Christian> i found the following mail (see below) on the clisp-list. i am working 
Christian> on windows and i would like to increase the stack size of the lisp.exe 
Christian> executable. now i wonder how to do this?

Christian> can anybody give me a hint?

Can you please try to explicitly call (gc) in the process of program
execution? Gc spends a lot of time, so it shouldn't be called
frequently. I don't mean it is normal, but that way you can
get an another confirmation (if it helps) that there is an inefficiency
in win32 gc's traversal (Joerg's 9nines bug).

You may also to risk to change four bytes in lisp.exe at positions 138-13B
to desired stack size value (least significant byte first).
But you need a binary editor for this and an idea about binary/hex codes.
Note - I didn't say that to you ;)

-- 
Best regards,
 Arseny                            mailto:[email-masked]

---

From: Arseny Slobodjuck <[email-masked]>
Date: Fri Jun 7 16:51:03 2002

Hello Arseny,

Friday, June 07, 2002, 10:36:30 PM, you wrote:

Arseny> Can you please try to explicitly call (gc) in the process of program
Arseny> execution? Gc spends a lot of time, so it shouldn't be called
Arseny> frequently. I don't mean it is normal, but that way you can
Arseny> get an another confirmation (if it helps) that there is an inefficiency
Arseny> in win32 gc's traversal (Joerg's 9nines bug).

Arseny> You may also to risk to change four bytes in lisp.exe at positions 138-13B
Arseny> to desired stack size value (least significant byte first).
Arseny> But you need a binary editor for this and an idea about binary/hex codes.
Arseny> Note - I didn't say that to you ;)
Moreover its wrong, very sorry, forget it. Stack size is not at the fixed
offset in the exe :(

As about (gc) it would be still interesting if periodical (gc) solves
your problem. It is important for clisp development.

---

From: lin8080 <[email-masked]>
Date: Fri Jul 5 13:25:14 2002

> can anybody give me a hint?

Hallo Christian

Now I found an entry in the system.ini which can solve your problem.
(look in the startup-logs whether system.ini gets read)

- In SYSTEM.INI in section [386Enh] add this line:

MinSPs=4

Windows reserved some stack-sides for 32-driver and applications. One
stack-side has 4k size and with the number 4 you set 4 stack-sides, so
the application can order on demand more stack-sides. 
I donot test this, so use it on your own risk. This is what I found
windows can do, not the lisp.exe

There is another panel where you can change the dos-box-properties: 

- Click on the properties in the menue bar, this should open and show
the following "cards": Program - Font - Memory - Screen - Misc. 
Now choose Memory and edit as you wish or need. 

- You can always go to the Screen-card and change the in the Usage-field
(on the top) the "Initial size" (there is an arrow-click-box on the
right side) to 50 lines. This makes on my PC a scroll-bar (50 lines) to
the dos-box and 50 lines :) (very usefull, but when you find a way to
edit this so that I can see all lines, this will make me happy. I guess
I have to search the regedit.exe)

- On the misc-card you can choose Quick Edit in the mouse field. This
allows to copy contents out of the dos-box window. Also you can edit
some hot-keys there.

stefan