Google has created a tool to fix software programs that fail to release computer memory back to the operating system
Google’s Chrome team created the tool, as memory leaks can be common in browsers – particularly some versions of Microsoft’s Internet Explorer, developers say.
A memory leak occurs when a computer program consumes memory but is unable to release it back to the operating system. In object-oriented programming, a memory leak happens when an object is stored in memory but cannot be accessed by the running code. A memory leak has symptoms similar to a number of other problems and often can only be diagnosed by a programmer with access to the program source code.
A memory leak can diminish the performance of the computer by reducing the amount of available memory. Eventually, in the worst case, too much of the available memory may become allocated and all or part of the system or device stops working correctly, the application fails, or the system slows down unacceptably.
The Chrome team delivered goog.Disposable to help out with the leakage issue. goog.Disposable is an interface for disposable objects.
“Before dropping the last reference to an object, which is an instance of goog.Disposable (or its subclass), the user code is supposed to invoke the method dispose() on the object,” the Chrome team wrote in the post. “This method can release resources, e.g., by disposing event listeners. However, a Web application might forget to call dispose() before dropping all the references to an object.”
Leak finder can detect goog.Disposable objects that were not disposed. It produces machine-readable output and can be used as a part of test automation.
To find leaks, Leak Finder relies on goog.Disposable monitoring mode. The mode gathers all created but not yet disposed instances of goog.Disposable. The default configuration of the tool detects goog.Disposable objects that were not disposed, Google said.
Are You An IT Olympian? Take our quiz.