Skip to main content

Please suggest a tool for Debugging Memory leak Bug in Java source code

2 replies [Last post]
Joined: 2008-02-26

Hi, our team just integrated few Application Programming Interfaces (APIs) in the Messaging module of mobile code created using Java.
After that, the messaging module of our phone is damn slow.... the messaging application is very sluggish, sometimes we observe crashes or the phone freezes!!!!!
We feel that the code of the new APIs that were integrated have lots of memory leaks. we feel that the memory were not freed properly by the code developers. Some chunks of memory were lost. Only after power cycling the phone, the phone behaves properly. But in few days again the same problem happens!!
We are in a critical phase of our project. Is there any tool that helps us out in finding the memory leaks in the code....?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-03-04

Have you tried the Memory Monitor and Profiler utilities in the WTK yet? These will give you a first estimate of which APIs and methods are called and whether there are overall memory leaks in the application.

As for analyzing memory leaks there are two angles: static and dynamic analysis. In static analysis you look at the source code (or use a tool) to determine whether incorrect design leads to memory leaks. In dynamic analysis you use a tool to track places where objects become unreachable but cannot be collected. The problem with dynamic analysis is that is requires hooks into the VM to collect data (such as JVMPI) but Java ME VMs typically don't support JVMPI.

-- Terrence

Joined: 2008-02-26

Hi, typically, a memory leak occurs because dynamically allocated memory has become unreachable. You can prevent memory leaks by watching for some common problems. Collection classes, such as hash tables and vectors, are common places to find the cause of a memory leak. This is particularly true if the class has been declared static and exists for the life of the application. . The prevalence of memory leak bugs has led to the development of a number of debugging tools to detect unreachable memory. Coverity Prevent is one of the tool that you can use for fixing these kinds of bugs. Coverity Prevent is also used by the Department of Homeland security to scan many open source projects. You can get more info at