It's been a while since I tried looking for a free profiler and as I recall, I ended up using a trial version of something. As far as polling memory usage at runtime, there are indeed some API for this in java.lang.Runtime: freeMemory(), maxMemory(), and totalMemory(). The docs are pretty good on that. I don't believe there's an easy Java-centric way to traverse an object graph and figure out how much memory is allocated for it.
Alexey 2001 Honda CBR600F4i (CCS) 1992 Kawasaki EX500 http://azinger.blogspot.com http://bsheet.sourceforge.net http://wcollage.sourceforge.net --- On Tue, 10/21/08, MassH <[EMAIL PROTECTED]> wrote: From: MassH <[EMAIL PROTECTED]> Subject: [The Java Posse] Recommend a good Profiler? To: "The Java Posse" <[email protected]> Date: Tuesday, October 21, 2008, 11:53 AM I've been spending lots of time with NetBeans profiler, but I'm unable to get passed various runtime errors. I've done Internet searches and found a dozen open source profilers that seem to be abandoned. JProbe looks great, but it's $700, which is completely out of my budget (I'd happily pay $100-$150 for a really nice profiler, but $700 is just too much for a tool on a personal project). Can I add Java code to query the JVM for memory usage and CPU usage info and use logs of that data to optimize? Specifcally, is it possible to query: - Amount of memory currently used by JVM? - Amount of memory used by a given HashMap (including keys + values)? - CPU cycle-type metrics? Of course, system clock is great, but sometimes, a more direct measure is preferred Also, when I use Java JConsole.exe, heap memory is split into Eden Space, Survivor Space, and Tenured/Old Space. I've read the docs, and don't quite understand the distinction between Eden/Survivor space. Could someone attempt to explain this? Alternatively, is there another platform with better performance characteristics and optimization tools than Java? I can migrate to a different dev toolset if need be. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
