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

runInContext memory leak #1170

Closed
astoilkov opened this issue Mar 17, 2015 · 5 comments
Closed

runInContext memory leak #1170

astoilkov opened this issue Mar 17, 2015 · 5 comments
Labels
vm Issues and PRs related to the vm subsystem.

Comments

@astoilkov
Copy link

I have been struggling for days with a memory leak with runInContext. I have tried to isolate the problem with no success. The problem is that the script that I am executing is around 14k lines and there is no way to understand from where in the script is the problem. What I have understood is that the problem comes from these 14k lines because when I remove them and execute simple code it's all fine.

  function executeCode(browserEnv, html, code) {
    var context = vm.createContext(browserEnv.getObject());
    var script = vm.createScript(code);

    extend(context, {
      server: {
        html: html,
        data: {},
        rendered: '',
        applications: []
      },
      require: require
    });

    script.runInContext(context);
  }

I am not sure how we could go about investigating the problem. If you have any suggestions I can cooperate fully.

Note: I didn't know if I should create an issue here or in contextify.

@Fishrock123 Fishrock123 added the vm Issues and PRs related to the vm subsystem. label Mar 17, 2015
@Fishrock123
Copy link
Contributor

Which version of io.js are you running?

io.js < 1.5.1 had a memory leak in TLSWrap, if you are using TLS / HTTPS, see #1075 (there's also a small other leak we are still investigating there, possibly related to smalloc).

@bnoordhuis
Copy link
Member

Do you have a simple test case (i.e. one that doesn't depend on third-party modules) that reproduces the issue? If so, I'll be happy to take a look.

@astoilkov
Copy link
Author

The most isolated test case I have been able to replicate the problem is by running the library I am developing with runInContext. However, I have said the library is 14k lines so it is not as I call it simple. If you think you have chance of finding the problem in such an example I will upload an example somewhere and provide you a link.

@bnoordhuis
Copy link
Member

As long as it doesn't have other dependencies, I can at least try to profile it and see if something stands out.

@Fishrock123
Copy link
Contributor

Reopen if we have get a core-only test case. As for debugging what you have further, maybe valgrind can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants