Setting stack and memory sizes in a script

Q&A's, tips, howto's

Setting stack and memory sizes in a script

Postby ralph.ronnquist » Sat Jun 07, 2014 4:16 am

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?
Posts: 207
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

Re: Setting stack and memory sizes in a script

Postby Lutz » Sat Jun 07, 2014 4:38 am

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.
Posts: 5276
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest