stackoverflower
stackoverflower

Reputation: 4073

Eden space usage constantly increasing when using Swing

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?

Upvotes: 2

Views: 4440

Answers (2)

Jakub Zaverka
Jakub Zaverka

Reputation: 8874

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

Upvotes: 1

sikander
sikander

Reputation: 2286

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.

Upvotes: 4

Related Questions