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

memory leak with iframe with same origin #311

Closed
sixinli opened this issue Nov 13, 2015 · 0 comments
Closed

memory leak with iframe with same origin #311

sixinli opened this issue Nov 13, 2015 · 0 comments

Comments

@sixinli
Copy link

sixinli commented Nov 13, 2015

Hi,

I have a site page that has an iframe referencing another page under the same origin/host, both pages use [email protected]. I have noticed that there's a leak when the iframe is destroyed, the memory is not freed.

Here is a simple repo:
index.html has an iframe referencing frame.html and has a button to toggle on and off of the iframe:

<html>
 <head>
    <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script>
 </head>
 <body>
    <script src="interact.js"></script>
    <iframe src="/frame.html"></iframe>
    <button id="mybutton">click me</button>
    <script type="text/javascript">
        var on = true;
        $("#mybutton").click(function() {
            if (on) {
                $("iframe").attr("src", "about:blank");
            } else {
                $("iframe").attr("src", "/frame.html");
            }
            on = !on;
        })
    </script>
 </body>
</html>

and inside the frame.html:

<html>
 <head></head>
 <body>
    <h2> im an iframe </h2>
    <script src="interact.js"></script>
    <script type="text/javascript">
        var array = [];
        for (var i = 0; i < 1000000; i++) {
             array.push(i);
        }
    </script>
 </body>
</html>

and here is screen shot of the heap snapshots:
snapshots
The odd number (1,3,5) snapshots are when the iframe is on, and the even number ones are when the iframe is off. Notice for example in snapshot2 (when the iframe is off), the memory usage is still the same when it should be lowered.

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

No branches or pull requests

1 participant