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

GPSEE can incorrectly GC script modules #96

Open
GoogleCodeExporter opened this issue Aug 23, 2015 · 2 comments
Open

GPSEE can incorrectly GC script modules #96

GoogleCodeExporter opened this issue Aug 23, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

It is trivial to create modules with internal state.

Script modules can be garbage collected when they are unreferenced by the 
calling environment.  They will be transparently reloaded on next use.  
However, this can create a visible error condition.

This problem does not affect native-language module which correctly implement 
the *_FiniModule() interface, as this interface tells the garbage collector 
that we have internal state.

Work around:  Create a GC root in script for any modules which hide internal 
state, e.g.

const msgex = require("msgex");

Suggested Fix: We need to turn this functionality off by default for script 
modules, and only enable it for modules that explicitly notify GPSEE that they 
can be garbage collected.  Suggested interface:  'module.pure = true'  (purity 
concept borrowed from gcc function attributes)

Original issue reported on code.google.com by wes@page.ca on 27 Jan 2012 at 7:55

@GoogleCodeExporter
Copy link
Author

We also need to be able to set 'module.pure = true' from the loader if we are 
working in a conceptual sandbox that should be reloadable and garbage collected.

Original comment by christ...@christophdorn.com on 27 Jan 2012 at 9:12

@GoogleCodeExporter
Copy link
Author

Original comment by wes@page.ca on 5 Sep 2012 at 3:17

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