Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
memory leak experiments
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Leak Test</title>
<meta http-equiv="refresh" content="2;url=">
</head>
<body>
<script type="text/javascript">
// http://gyazo.com/330b6b2f7809db8a12549b523db8efc0.png
(function() {
var data = { };
var i =-1, l = 1000;
while (++i < l) {
(function(i) {
data[i] = new ActiveXObject('Microsoft.XMLHTTP');
data[i].onreadystatechange = function(){
if (data[i].readyState == 4) {
alert(data[i].responseText);
}
};
})(i);
}
})();
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>No Leak Test</title>
<meta http-equiv="refresh" content="2;url=">
</head>
<body>
<script type="text/javascript">
// http://gyazo.com/6b30dbf5ff1c49c6466691a942c4a757.png
// moved `data` to the global namespace
var data = { };
(function() {
var i =-1, l = 1000;
while (++i < l) {
(function(i) {
data[i] = new ActiveXObject('Microsoft.XMLHTTP');
data[i].onreadystatechange = function(){
if (data[i].readyState == 4) {
alert(data[i].responseText);
}
};
})(i);
}
})();
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>No Leak Test</title>
<meta http-equiv="refresh" content="2;url=">
</head>
<body>
<script type="text/javascript">
(function(global) {
// this will work too
global.data = { };
var i =-1, l = 1000;
while (++i < l) {
(function(i) {
data[i] = new ActiveXObject('Microsoft.XMLHTTP');
data[i].onreadystatechange = function(){
if (data[i].readyState == 4) {
alert(data[i].responseText);
}
};
})(i);
}
})(this);
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>No Leak Test</title>
<meta http-equiv="refresh" content="2;url=">
</head>
<body>
<script type="text/javascript">
// this will do too :D
var data = { },
createHandler = function(id) {
return function() {
var xhr = data[id];
if (xhr.readyState == 4) {
alert(xhr.responseText);
}
};
},
getId = (function() {
var id = 0;
return function() {
return ++id;
};
})(),
Ajaxy = function() {
this.id = getId();
this.raw =
data[this.id] = new ActiveXObject('Microsoft.XMLHTTP');
this.raw.onreadystatechange = createHandler(this.id);
};
(function() {
var i =-1, l = 1000;
while (++i < l) new Ajaxy;
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.