-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix handling of memory limit #385
Conversation
qjs.c
Outdated
// TODO(chqrlie): accept kmg suffixes | ||
stack_size = (size_t)strtod(opt_arg, NULL); | ||
stack_size = (int)atoi(opt_arg); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark
I'll give it another shot. |
Default to 0, which is "disabled", just like the stack limit.
55ecf9d
to
4b83dd2
Compare
@chqrlie PTAL and let me know what you think! |
@saghul : as you changed the default unit, you should update the
This will fix the |
Good one! I got a bit busy and hadn't dug deep enough, thanks for the pointer! |
@chqrlie Updated, PTAL! |
qjs.c
Outdated
if (memory_limit >= 0) | ||
JS_SetMemoryLimit(rt, (size_t)memory_limit * 1024 /* QuickJS needs bytes. */); | ||
if (stack_size >= 0) | ||
JS_SetMaxStackSize(rt, (size_t)stack_size * 1024 /* QuickJS needs bytes. */); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not multiply by 1024
if you use my proposed version for parse_imit
.
Switch the default in the CLI to kilobytes too.
@chqrlie Thanks a lot for the remark on |
Default to 0, which is "disabled", just like the stack limit.