2

I'm a beginner in the domain of JVM, but I noticed that when Swing components are used, like JFrame, the Eden space usage constantly increases (at constant speed I suppose, since the graph plotted in VisualVM is a rising straight line), until the GC sends it back to the lowest point. As the Eden space is used for newly created objects, I wonder what is constantly creating those objects, and if the same effect still happens without Swing components.

[Edit]

After looking at the heap dump, I found that the objects created are of type char[] and int[]. What's are those objects for?

stackoverflower
  • 3,885
  • 10
  • 47
  • 71

2 Answers2

4

The JVM creates new objects in Eden space so it is OK if it rises in a straight line until the GC clears it out. Java memory is managed in "generations" and objects are moved from the youngest generation (Eden) to Perm depending on how old they are.

Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine is a good article about memory management in Java.

sikander
  • 2,286
  • 16
  • 23
  • Thanks for the reply. I understand that new objects are created in Eden space, but what are they in this case? Are they created by the Event Dispatch Thread when waiting for input events, or by other daemon threads? – stackoverflower Mar 19 '12 at 08:48
  • You'll need to use a Profiler to find out what is actually being created. Try http://netbeans.dzone.com/vvm-displaying-java-memory-pool-stats – sikander Mar 19 '12 at 08:52
1

The problem actually may be caused by profiling with VisualVM, see this.

Community
  • 1
  • 1
Jakub Zaverka
  • 8,816
  • 3
  • 32
  • 48