Why does hprof=heap=dump have so much overhead?

I udnerstand why the HPROF option heap=sites incurs a massive performance overhead; it has to intercept every allocation and record the current call stack.
However, I don't understand why the HPROF option heap=dump incurs so much of a performance overhead. Presumably it could do nothing until invoked, and only then trace from the system roots the entire heap.
Can anyone speak to why it doesn't work that way?
- Gordon @ IA

Traditionally agents like hprof had to be loaded into the virtual machine at startup, and this was the only way to capture these object allocations. The new hprof in the JDK 5.0 release (Tiger) was written using the newer VM interface JVM TI and this new hprof was mostly meant to reproduce the functionality of the old hprof from JDK 1.4.2 that used JVMPI. (Just FYI: run 'java -Xrunhprof:help' for help on hprof).
The JDK 5.0 hprof will at startup, instrument java.lang.Object.<init>() and all classes and methods that use the newarray bytecodes. This instrumentation doesn't take long and is just an initial startup cost, it's the run time and what happens then that is the performance bottleneck. At run time, as any object is allocated, the instrumented methods trigger an extra call into a Java tracker class which in turn makes a JNI call into the hprof agent and native code. At that point, hprof needs to track all the objects that are live (the JVM TI free event tells it when an object is freed), which takes a table inside the hprof agent and memory space. So if the machine you are using is low on RAM, using hprof will cause drastic slowdowns, you might try heap=sites which uses less memory but just tracks allocations based on site of allocation not individual objects.
The more likely run time performance issue is that at each allocation, hprof wants to get the stack trace, this can be expensive, depends on how many objects are allocated. You could try using depth=0 and see if the stack trace samples are a serious issue for your situation. If you don't need stack traces, then you would be better off looking at the pmap command that gets you an hprof binary dump on the fly, no overhead, then you can use jhat (or HAT) to browse the heap. This may require use of the JDK 6 (Mustang) release for this experiment, see http://mustang.dev.java.net for the free downloads of JDK 6 (Mustang).
There is an RFE for hprof to allow the tracking of allocations to be turned on/off in the Java tracker methods that were injected, at the Java source level. But this would require adding some Java APIs to control sun/tools/hprof/Tracker which is in rt.jar. This is very possible and more with the JVM TI interfaces.
If you haven't tried the NetBeans Profiler (http://www.netbeans.org) you may want to look at it. It does take an incremental approach to instrumentation and tries to focus in on the areas of interest and allows you to limit the overhead of the profiler. It works with the latest JDK 5 (Tiger) update release, see http://java.sun.com/j2se.
Oh yes, also look at some of the JVM TI demos that come with the JDK 5 download. Look in the demo/jvmti directory and try the small agents HeapTracker and HeapViewer, they have much lower overhead and the binaries and all the source is right there for you to just use or modify and customize for yourself.
Hope this helps.
-kto

Similar Messages

  • Why does the iPad 3 have so much lag on ios7?

    My iPad 3 has so much lag on ios7 i cant believe apple would pass this i have restored twice and set up as new ipad and still does not fix the lag. It takes at least 10 seconds to change a wallpaper even rotating the ipad lags also safari is really bad wish i didn't update now. Ios7 is smooth as butter on my iPhone 5 how could apple get it so wrong on the iPad! There is alot of reports of ios7 being laggy on the iPad 4 and mini aswell. I cant seem to get rid of the lag no matter what i try does anyone have any suggestions? Apple?    

    Hello,
    It is luckily that an iOS 7 update will be coming out this week. As it's 7.0, there is a lot of bug so just wait to you update for a 2 week. Try restarting your iPad by holding the power button and the home button down at the same time till you see a apple, that will help.
    Please reply if you have any more questions.
    Kind Regards,
    Onecarb

  • Why does my iPhone 5 have so much trouble with network connections?

    My iPhone 5 cannot hold a consistent network connection. It jumps all over the place. Back and forth from 4G (att 3G) to EVDO to nothing. I am in areas where my old iPhones have had no problems. I drop calls and have failed downloads everyday. Not what i expected...

    I live in NJ. I've had every version of the iPhone. iPhone 5 is the worst. Or is it that AT&amp;T is the worst?  I'm still trying to decipher if the problem is the phone or the AT&amp;T network. At times I'll have no bars. My iPhone 5 will go from no bars to the Edge network or vice versa. And I'll have to shut the phone off &amp; turn it back on just to get the bars &amp; 4G back. I don't use the LTE because it drains the **** out of the battery. Another thing I've noticed is that I don't get all my text messages &amp; voicemail notices, at times, hours late. This is very frustrating since I haven't had this problem with any other iPhone that I ever owned.  Please help! SIM card change before exchanging the iphone out? PLEASE HELP!

  • Why does my MacBook Pro have so much trouble playing video people send me?

    Whether it's embedded, or a link to YouTube or some other site, for the past week or longer I've been having great trouble getting video -- even at the lowest quality setting -- to play straight through.
    Is it Mountain Lion?
    Is it something else I downloaded, or should have?
    Is it my ISP?
    How do I find out where to point the finger? (I figure it can't possibly be me . . . right?)

    Your situation is not unique. Another long thread https://discussions.apple.com/thread/1758587?start=90&tstart=0 suggests that a solution is not yet forthcoming.
    You can, however, partially remedy the situation by (1) making sure your system is not too warm or hot - this really reduces the life of your battery; (2) Keep your unit charged for portions of the day; display quality is better while powered, and battery will keep more of its power; (3) In some cases, keeping your MBP connected to USB cables can leech power from your system; detach all cables before sleeping.
    Of course, this won't solve the problem, but it will improve things. If it's any consolation, many (but not all) Windowz units report the same problem.
    Post here if you have any comments, advice, or even feedback!

  • Why does the latest iOS have so much trouble connecting with Bluetooth

    My Bluetooth will not connect to sound docks.

    I too am having bluetooth problems since ios 7.1.1 (iPhone 5s).  phone will pair to car  contacts show up but when I try to make a call it reverts back to handset.  no way to overide.  It worked perfect until update.  I have tried unpairing/ forgetting device but no luck.  It has no problem pairing!
    Is there an easy way to revert back to ios 7.1?

  • Why does iPad 2 only have a 16 GB option?

    Why does iPad 2 only have a 16 GB option?

    You can get a refurb iPad 2 with 16GB, 32GB & 64GB.
    What are all the differences between the iPad 3rd Gen and the iPad 2? Is the iPad 2 worth the cost savings?
    http://everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd-gen -2012-ipad-2-2011.html
    What are all the differences between the iPad 3rd Gen models? Which should I buy?
    http://everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd-gen -early-2012-models.html
    Should I Buy a New iPad? Or an iPad 2?
    http://www.maclife.com/article/blogs/should_i_buy_new_ipad_or_ipad_2
    iPad Q&A
    http://www.everymac.com/systems/apple/ipad/ipad-faq/differences-between-ipad-3rd -gen-early-2012-models.html
    A Few Questions (and Answers) About the New iPad
    http://pogue.blogs.nytimes.com/2012/03/15/a-few-questions-and-answers-about-the-   new-ipad/?ref=personaltechemail&nl=technology&emc=edit_ct_20120315
    New iPad: A Polishing of the Old
    http://www.nytimes.com/2012/03/15/technology/personaltech/the-new-ipad-is-much-t he-same-only-better.html?nl=technology&emc=edit_ct_20120315
    iPad 1, 2 and New Specifications
    http://www.everymac.com/systems/apple/ipad/index-ipad-specs.html
    How much content will fit on my iPod or iPhone?
    http://support.apple.com/kb/HT1867
    If you think you may get an iPad 2:
    Refurbished iPad Prices
    http://store.apple.com/us/browse/home/specialdeals/ipad
    New 16GB iPad 2 Prices
    http://store.apple.com/us/browse/home/shop_ipad/family/ipad/select_ipad2
     Cheers, Tom

  • I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great

    I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great!

    The fact that you can receive means you have a valid e mail address, and have established the connection to the incoming server, so all of that works.  Since the send does not work, that means your outgoing server is rejecting whatever settings you used formthe outgoing set up.  Try them again. 
    Google your particular isp, and ipad and many times you will find the exact settings needed for your isp.  Or tell us here, and soneone else may be on the same isp.  Some mail services need you to change a port, or have a unique name for the outgoing server.  
    Kep trying.

  • Why does itunes in France have a complete lack of english language content on the TV programmes... prefering to release dubbed programmes and not the original english language content, surely it will cost nothing to release both?

    Why does itunes in France have a complete lack of english language content... prefering to release dubbed programmes and not the original english language content?
    It would be just as easy to release both a dubbed version and then a subtitled version.
    I am a native english speaker but live in France. My father has just moved over to live with me in France and speaks very little French.
    The price for a television series is very often more than a dvd box set but does not offer language options.
    My French is passable but I would still prefer to hear the programme in English.
    Using itunes uk is not an option as my cards are french or english with a french postal address.
    The content has been adapted for the french site all i want is to access the original.
    The series i have been trying to buy is HBOs 'boardwalk empire'.
    The stupid thing is to please my father i would buy up most the HBO, BBC and Channel 4 content a cost of a couple of thousand euros.

    Try giving Apple feedback: http://www.apple.com/feedback and also contact the Apple headquarters at http://www.apple.com/contact  We are all fellow users and not Apple employees and often raise questions like yours ourselves.  If enough make Apple aware of a market/need then something may be done about it.
    France has come a very long way with regard to other languages.  When I lived in France, mid-880s, there was an entire Ministry devoted to the purity of the French language...that was the time the PC came out.  A TV news person was cashiered for using the term 'computer' on-air instead of the French created word 'ordinateur'.  They took the language extremely seriously at that time.  At least today there is recognition and even use of English by the masses

  • Why does front row not have simple organization?

    I currently have a hard drive hooked into my macmini which is hooked up to my TV. On my hard drive I have over 1000 movies, all purchased through iTunes. However when I use front row and i goto the movie section, I have to scroll through every movie to get to the one I want. There's no way to scroll by letter, only one by one. This is horrible and takes forever. Can apple do an update that makes the right button on the apple remote for scrolling letter by letter. For example, you click the right button to goto movies starting with B, C, D, E, F, etc. Then the down button for one by one scrolling. Also, why does front row not have genres? AppleTV does. Why not incorporate that into front row? Think, Apple, Think.

    You can have sub-folders in the Movies folder and arrange your movies alphabetically that way.
    But if you want to alert Apple to your idea, then use this link:
    Where to send product feedback to Apple:
    http://www.apple.com/feedback/

  • Why does iTunes say I have two different total numbers of movies?

    On the sidebar, it lists 371 Movies. When I'm in Movies with everything listed, the number at the bottom next to total number of hours is 372 Movies. 372 Movies is the correct number of movies. I have all of those movies also loaded into iTunes on my laptop running 10.7. These are all movies which are hosted locally on a hard drive; none of them are iCloud downloads or matches. So why does it think I have 1 less movie on the side bar? Is there a way to find out if one particular film hasn't loaded properly or can't be read for some reason? Thanks

    The sidebar lists # of unplayed (not completed) items.
    They should have a blue dot (not played) or half blue dot (started but not completed) next to the name.

  • Why does my iMac only have 1 GB of memory?  I hardly have anything on here.  I cannot download software update in order to get Turbo Tax to work.

    Why does my iMac only have 1 GB of memory?  

    Put in more RAM. Visit OWC, DataMem, or Crucial.com to purchase memory for your model. You computer would have more memory had you put more in a long time ago.

  • Why does my application icons have a cirle with a slash on them?

    why does my application icons have a cirle with a slash on them?

    That means those applications cannot be run on your computer.
    There are many different reasons why that situation could arise, but without more information all we can do is speculate / guess. For example, you upgraded the OS and the apps will not run in the new OS.
    If you need more specific answers.ost back with more information, e.g. what version of Mac OS X? when did this first occur?

  • Why does my Apple TV have to frequently reactivate some channels

    Why does my Apple TV have to frequently reactivate some channels, such as HBO Go and PBS and several others that I know were already activated.

    Maybe a software update reset something, maybe the broadcasters require this at intervals, could someone have logged/signed out?  Sorry don't get those channels in UK, but once Netflix made me log in again, others seem ok.
    You could send some feedback if this happens very often:
    Apple - Apple TV - Feedback

  • Why does my icloud calendar have Japanese AND English writing in it? Did I miss a setting I have to change?

    Why does my icloud calendar have Japanese AND English writing in it? Did I miss a setting I have to change? 

    Found a solution form an other post.
    I hade to stop the sync to my iPad to delete the calendars on it.
    Then I synced again and only had the new calendars that I had in my ICal.

  • Why does the iPhone Keyboard have a reversed period and comma from the normal keyboard?

    Why does the iPhone Keyboard have a reversed period and comma from the normal keyboard?

    MacinNW_Brent wrote:
    I don't mean to drive a Marine crazy, but there is no such thing as a standard keyboard. Especially tiny ones. Looks at a phone key pad, and then look at a calulator keypad. It is flipped top to bottom.
    JajLvr, if it drives you crasy, then get a BT keyboard.
    Brent
    Agreed.  Even the iPhone has multiple built-in keyboards to choose from.

Maybe you are looking for

  • How do you add multiple emails to iCal group?

    By using Edit Distribution List, I can specify which of several email addresses for one contact should be mailed as part of a Group.  But what if I want to include more than one of the email addresses that is included in a contact (for example, both

  • Getting an "uncaught exception" error when trying to Scan a document via D-Link DPR-1260 print sever (worked in prior versions of Firefox)

    I'm using the interface (Firmware V1.24) on a D-Link DPR-1260 Print Server, connected to an Epson Printer/Scanner. When I hit the "Scan" button, I get an "uncaught exception" error. This firmware has been working for years (at least back to Firefox 3

  • J2ee security newbie: integrated authentication question

    I am trying to build a set of JSPs/servlets that require authentication and probably authorization. The jsp / sevlets should be able to authenticate against any underlying password system, or should cope with most common systems such as win2k / unix

  • Looking for Printer Test program

    I'm trying to find an ABAP program that will let me test out whether we have printers defined in SAP correctly.  Ideally the functionality I'm looking for would be an ABAP program that when run would display a list of all the printers defined in SPAD

  • Reg Property Class

    Hi all, i created 2 visual attributes NEGATIVE,NON_NEGATIVE and given different background colors, Then i created a property class with some properties of PURCHASE_COST field in the form names as US_CURRENCY. I created When-Validate-Item trigger unde