Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Memory Leak Profiling with NetBeans and HotSpot

Memory Leak Profiling with NetBeans and HotSpot

More Decks by Clarence J M Tauro (Couchbase)

Other Decks in Programming

Transcript

  1. 1

  2. <Insert Picture Here> Memory Leak Profiling with NetBeans and HotSpot

    Clarence J M Tauro Senior Curriculum Developer, Oracle ST Java Curriculum
  3. 3 <Insert Picture Here> Session Agenda • About the Speaker

    • Different aspects of Performance • Memory leaks and profiling • Demo
  4. 4 About the Speaker • Clarence J M Tauro –

    [email protected] • Senior Curriculum Developer, Java Curriculum (Oracle ST Curriculum) • ~7 Years Professional Teaching and Instructional Design Experience • Masters of Science in Information Technology • Masters of Technology in Computer Science • Masters of Philosophy in Computer Science • Doctor of Philosophy in Computer Science [expected to graduate by August 2012] • Guest faculty to various Colleges and Universities
  5. 5 Different Aspects of Performance Performance Aspects Memory footprint Scalability

    Responsiveness Throughput In this talk we will look at memory profiling
  6. 6 Memory Leak Profiling: Why and When • Memory leaks

    are situations where a reference to allocated objects remains unintentionally reachable and as a result cannot be garbage collected. – Leads to poor application performance – Can lead to application failure – Can be hard to diagnose
  7. 9 Profiling • An act of collecting or observing performance

    data from an operating or running application. • Usually more intrusive than monitoring. • Usually a narrower focus than monitoring.
  8. 12 DEMO – NetBeans Profiler Configuration I am interested in

    Garbage collection statistics too Choosing this option has a lot of additional overhead
  9. 22 DEMO – Find Usages on HttpUnitOptions.clearScriptErrorMessages() Ahh.. Haa.. You

    just found the root cause of the memory leak. The _errorMessages ArrayList is NEVER cleared.. It has only elements added to it.
  10. 23 Farewell to the memory leak! So, to fix this

    memory leak, the ArrayList needs to be explicitly cleared. This is a task for the authors of HttpUnit
  11. 24 • Java Performance Tuning and Optimization Course from Oracle

    University • Java Performance - Charlie Hunt (Author), Binu John (Author) (Expected August 2011) Where to go?
  12. 25