block by GerHobbelt 2599189

mootools Request leak test

Full Screen

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:

index.html

<!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>