YourKit Java Profiler is an excellent tool for tracking down and fixing performance issues and memory leaks in Java applications, from desktop apps to Web applications.
Much like a debugger, a profiler lets you connect to a running Java application, allow it to run for a little while, and then pause it to analyze its state at any given time. It lets you take “snapshots” of the hierarchy of Java objects that exist in memory, and compare snapshots taken at different times to identify memory leaks. It also analyzes the time your application spends running the different parts of your application’s code, so you can target areas that have a large impact on performance for optimization.
After playing with several options in this area, YourKit Java Profiler is certainly my pick of the bunch. It’s got really pleasant interface to work with, with facilities for analyzing just about any kind of Java program. It’s also better than the competition at analyzing programs in tricky conditions (e.g. an applet running in a Java 1.3-era browser plug-in). It will also integrate with all the major IDEs (Eclipse, NetBeans, IDEA, JBuilder and JDeveloper), to fit into your normal workflow.
Until January 15th, YourKit is selling personal developer licenses for YourKit Java Profiler at $125–that’s 75% off the normal commercial license price. The only restriction on this license is that only one person can use it (the commercial license can be bought by a company for use by any of its developers).