Page 1 of 1

Setting stack and memory sizes in a script

Posted: Sat Jun 07, 2014 4:16 am
by ralph.ronnquist
I just ran into the following quirk. Basically, I wanted to include stack and memory limits in a script and therefore thought I could do it in the script header line, as:

Code: Select all

!#/usr/bin/newlisp -s 4096 -m 100
but then I discovered that only the first of these options come into play.

Eventually I learnt that the "optional arguments" for the script interpreter are actually passed in as a single first command line argument of the whole rest of line (this is on Linux), and newlisp happily and silently(!) takes an argument of '-s 4096 -m 100' to be the same as '-s4096'. Also, it appears that the handling and delivery of optional arguments may vary across platforms, so maybe one shouldn't use them at all.

But then, how do I make the script set its limits (and other options)? Do I have to have a separate wrapper shell script for its invocation?

Re: Setting stack and memory sizes in a script

Posted: Sat Jun 07, 2014 4:38 am
by Lutz
The only way to make options works consistently on different OSs is when options are specified on the command line - or in a wrapper shell script - and not in the script "#!" line.

Currently your example would only work correcty on Mac OS X, all others will only take the first option. I will try to make it work for other OSs in a future version.