Skip to content

Make js_class_id_alloc thread-local to avoid the 1 << 16 maximum size limits #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andycall
Copy link

We are using QuickJS's JSRuntime in separate threads. We encountered an issue where JS_NewClass could fail if JS_NewRuntime and JS_FreeRuntime are called hundreds of times across many forked threads.

In this patch, we make js_class_id_alloc thread-local to ensure that each forked thread's class ID starts at JS_CLASS_INIT_COUNT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant