Poor Man’s Profiling

Some time back I wrote about how OptimizeIt was useful in profiling our application. If you can’t afford OptimizeIt Java provides you an alternative poor man’s profiling tool in the Runtime class. The Runtime class allows you get the total heap size and the amount of available memory. Using these methods you can estimate how much memory you application is consuming with some simple math:

Runtime rt = Runtime.getRuntime();
long using = (rt.totalMemory() - rt.freeMemory()) / 1024;

Related posts:

  1. OptimizeIt Profiler 5.0
  2. Introduction to Classes and Objects
  3. Java Five-Oh #2: Static Import
  4. YourKit Java Profiler 7.0 Review
  5. Ruby Mixin Tutorial

This entry was posted in Java, Programming, TechKnow. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*