mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add (undocumented) option 'rsrclimit' to limit resource usage.
This commit is contained in:
parent
f1b05dd2ff
commit
6fe4cc3ae8
1 changed files with 11 additions and 2 deletions
13
main.py
13
main.py
|
@ -257,7 +257,7 @@ Case insensitive.
|
||||||
Firestorm, but not recommended. Note that the operand to
|
Firestorm, but not recommended. Note that the operand to
|
||||||
switch() may be evaluated more than once.
|
switch() may be evaluated more than once.
|
||||||
ErrMissingDefault + Throw an error in case the 'default:' label of a switch
|
ErrMissingDefault + Throw an error in case the 'default:' label of a switch
|
||||||
statement is missing.
|
statement is missing. Only meaningful with EnableSwitch.
|
||||||
FuncOverride - Allow duplicate function definitions to override the
|
FuncOverride - Allow duplicate function definitions to override the
|
||||||
previous definition. For compatibility with Firestorm's
|
previous definition. For compatibility with Firestorm's
|
||||||
optimizer.
|
optimizer.
|
||||||
|
@ -322,7 +322,9 @@ validoptions = frozenset(('extendedglobalexpr','breakcont','extendedtypecast',
|
||||||
'lazylists','enableswitch','errmissingdefault','funcoverride','optimize',
|
'lazylists','enableswitch','errmissingdefault','funcoverride','optimize',
|
||||||
'optsigns','optfloats','constfold','dcr','shrinknames','addstrings',
|
'optsigns','optfloats','constfold','dcr','shrinknames','addstrings',
|
||||||
'foldtabs','warntabs','processpre','explicitcast','listlength',
|
'foldtabs','warntabs','processpre','explicitcast','listlength',
|
||||||
'help','lso','expr'
|
'help',
|
||||||
|
# undocumented
|
||||||
|
'lso','expr','rsrclimit',
|
||||||
# 'clear' is handled as a special case
|
# 'clear' is handled as a special case
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -493,6 +495,13 @@ def main(argv):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
if 'rsrclimit' in options:
|
||||||
|
import resource
|
||||||
|
resource.setrlimit(resource.RLIMIT_CPU, (5, 5))
|
||||||
|
resource.setrlimit(resource.RLIMIT_STACK, (393216, 393216))
|
||||||
|
resource.setrlimit(resource.RLIMIT_DATA, (4096, 4096))
|
||||||
|
resource.setrlimit(resource.RLIMIT_AS, (20001000, 20001000))
|
||||||
|
|
||||||
if 'lso' in options:
|
if 'lso' in options:
|
||||||
lslopt.lslcommon.LSO = True
|
lslopt.lslcommon.LSO = True
|
||||||
options.remove('lso')
|
options.remove('lso')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue