BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Open Sources Leak Finder, a JavaScript Tool for Detecting Memory Leaks

Google Open Sources Leak Finder, a JavaScript Tool for Detecting Memory Leaks

Leia em Português

This item in japanese

Bookmarks

Google has open sourced Leak Finder, a tool inspecting the heap of JavaScript applications in order to find memory leaks.

As a garbage collected language JavaScript does not have the usual memory leaks typically found in other languages such as C++. But when memory is still allocated to objects that are no longer used it is said that the application has memory leaks, and if the leaks are important then the application may show reduced performance or even fail to execute.

One of the ways of possibly getting a memory leak in JavaScript is with circular references, especially when closures are used. Leak Finder can detect when a closure produces a leak, warning the developer and pointing to the faulty code. The tool looks for Google Closures’ goog.Disposable objects in the heap, verifying if the dispose() method was called and whether event listeners were released, because they can hold references to DOM objects, thus leaking memory.

Currently, Leak Finder works with Closures but it can be configured to work with other libraries. Closures is an open source JavaScript library containing widgets, an event framework, tools for DOM manipulation, a unit testing framework, animation tools, and other components, being used extensively across Google services such as GMail, GDocs, GMaps and others.

Also, code analysis must be done with Chrome 21 or later using remote debugging and the development tools.

Google open sourced in the past a number of other JavaScript tools such as the Closure Compiler, a tool generating compact and high performance code, Closure Templates for dynamically generating HTML, Closure Linter, a JavaScript style checker, and Closure Stylesheets, a set of extensions to CSS. GWT, another toolkit for building JavaScript applications, has had a release candidate in June, but its future is uncertain since Google has moved many of their GWT developers to Dart, which is seen as “an ambitious evolution of GWT’s mission to make web apps better for end users, and we’re optimistic about its potential.”

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • garbage collecting and circular references

    by o f,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I am not an expert but a garbage collecting language isn't vulnerable to circular reference related memory leaks is it? Rather reference counting languages are.
    I don't know what Javascript is but I would guess reference counting.

    Please someone correct me if I am wrong.

  • Re: garbage collecting and circular references

    by Abel Avram,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Check out this rather old but still actual post: www.ibm.com/developerworks/web/library/wa-memleak/

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT