Question: I have a Gridview with a select button. That select button causes a DetailsView to be created. I am using a custom DataBind method for the DetailsView. The custom DataBind method does call detailsview.DataBind() which then fires detailsview\_ItemCreated. The EventArgs for detailsview\_ItemCreated is empty.

I need to get the ID of the "parent" GridView.

detailsview\_ItemCreated fires immediately after detailsview\_DataBind() executes in the custom DataBind method so I'm not sure if I could add to EventArgs at some point or if I need to fire the method itself from the DataBind method. Or something else altogether.

Any help is appreciated

Answer: 
Try these operations:

1. set the iframe url to blank page, such as "";
2. break your page's refs which may ref to the objects of iframe page;
3. set all objects created by the iframe page to null or undefined.

Operation 2 and 3 are available only if the iframe's page is developed by yourself.

If you did 1 and 2, then the chrome will release the js heap immediately which is allocated by the iframe page.

If you did 1, 2 and 3 then the firefox will release the js heap immediately too.

But, even if you did all the operations above, the Safari won't release the js heap in a period.
I wrote this snippet that can help clean the `iframe` before removing it:

```js
(function () {
    var beforeKeys = []
    for (var k in window) {
        beforeKeys.push(k)
    }

    function wipeCreatedKeys() {
        for (var k in window) {
            if (beforeKeys.indexOf(k) !== -1) {
                continue
            }
            window[k] = null
        }
    }

    window.wipeCreatedKeys = wipeCreatedKeys;
})();

```

Add it as soon as possible in your `iframe`, and call `wipeCreatedKeys` before unloading/removing it.

Major performance improvements on Firefox. Chrome doesn't need that, though.