• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt Using NetBeans builtin profiler

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello All ,

I am trying to learn Profiling the code . For this i am using Netbeans builtin Profiler .

I have simply created a Project with default index.jsp(That comes with the IDE) and deployed the Applicication in Tomcat 5.0 .

Now my doubt is when i ran profiler and checking the Memory Results , what i observed is the char[] class name and other other classes are increasing their size.

Is this a memory Leak ??

Please tell me .
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to run your application for a long time to see if it's really a memory leak. Keep in mind that garbage collection only occurs periodically, so if you're running a short program you may not see the objects get garbage collected, because the GC just hasn't bothered to do it yet. You can also call System.gc() to manually invoke garbage collection, and then do Thread.sleep for a while.

In Netbeans, try using the VM Telemetry view (under the Profiler tab) to watch the total memory usage. (You can set the profiling mode to "monitor" rather than "memory" or "cpu", which takes much less overhead because it's just keeping track of the VM Telemetry info.) If you run the program for a long time, you should start to see a wave-like pattern where the total memory usage drops at each garbage collection, then slowly builds up, then drops again. However, if the memory usage slowly goes up over time, then you know you've got a memory leak. That's when you should start doing actual memory profiling and see if your char arrays are being persisted rather than garbage collected. It could also be some other data structure you never guessed, so keep track of the "surviving generations" rather than total number. Netbeans has a good tutorial here: http://www.netbeans.org/kb/articles/nb-profiler-uncoveringleaks_pt1.html
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Norman . It was a nice explanation .

I have a one more question , if we set the XMX for 256M and if it exceeds will this throw an OOM or the Operating system will manage ??


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic