Skip to content

Instantly share code, notes, and snippets.

@GerHobbelt
Created May 5, 2012 02:32
Show Gist options
  • Save GerHobbelt/2599189 to your computer and use it in GitHub Desktop.
Save GerHobbelt/2599189 to your computer and use it in GitHub Desktop.
mootools Request leak test
# Editor backup files
*.bak
*~

As reported on mootools ML:

gdot 9:42 PM (6 hours ago)

to mootools-users

This leak still exists in 1.3.2 :(

On Thursday, December 23, 2010 1:52:14 PM UTC-5, Luke Ehresman wrote:

I have discovered what I believe to be a pretty serious memory leak in the Request class. My site has long-running scripts with large data payloads. So, a user may leave the page open for days at a time without reloading the page. During that time, the site makes many AJAX requests to my server. I've noticed that my browser (all browsers I've tested -- Chrome, Safari, and Firefox) degrade pretty quickly and consume copious amounts of memory within a few hours.

After several days of debugging, I have identified that it's a problem with the Request class in MooTools. Here is a sample script to recreate the problem:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools.js"></script>
</head>
<body>
<script type="text/javascript">
document.addEvent("domready", req);
function req() {
new Request({
url: "index.json", // a large JSON-encoded file, ~250k
onSuccess: success
}).get();
}
function success(resp) {
setTimeout(req, 1000);
}
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment