Skip to content
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

Should the GC library be unsafe? #49

Closed
JarrettBillingsley opened this issue Jul 27, 2012 · 1 comment
Closed

Should the GC library be unsafe? #49

JarrettBillingsley opened this issue Jul 27, 2012 · 1 comment

Comments

@JarrettBillingsley
Copy link
Owner

The GC library isn't really a "core" library in the sense that it's not "blessed" in any way like the other core libs. It would, however, be easy for malicious scripts to crash the host by disabling collections, which would cause a memory allocation failure eventually (and most hosts probably wouldn't be programmed to deal with that situation).

There is, however, one feature in the GC library that the stdlib depends upon: the hash library uses post-GC callbacks to normalize weak tables. I suppose this could be solved by making weakref objects work more like in Java (where they can be assigned to a queue to which they're pushed when they go null).. or by exposing the post-GC callback interface to native code, and only exposing it to script code when the GC lib is loaded?

@JarrettBillingsley
Copy link
Owner Author

Hmmm.. I think nah. I mean, malicious code could cause a memory allocation failure much more easily by just allocating several enormous memblocks or something. So, yeah, not really any different here.

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

No branches or pull requests

1 participant