0

In my app start up, I'm creating trove long hash set with 75*10^6 capacity.

Profiler shows, that app use 1.4g for it. I'm try to set -Xmx1600m, and catch out of memory.

-Xmx2000m same.

-Xmx2030m same.

-Xmx2040m OK.

Profiler doesn't see so big allocation, where and why it's happen?

mishka
  • 2,027
  • 2
  • 20
  • 30
  • 1
    Do you think we can solve this problem from probably 1000s of miles away, without any soecific details? Set the JVM option to create a heap dump in case of OOME, and analyse that with an appriopriate tool, like Eclipse Memory Analyser – ppeterka Oct 09 '13 at 08:07

1 Answers1

2

Most likely your tenured space is not large enough. The jvm might not be smart enough to shrink other regions to allow you such a large continuous block. Note CMS doesn't defrag so you can get this problem with much smaller arrays.

For a collection that big you might consider using off heap memory.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • I'm increase tenured space by decrease new ratio -XX:NewRatio=10 (my case), and it's works! – mishka Oct 20 '13 at 08:32
  • 1
    @MikhailErofeev When you decrease the new ration, you increase the new space, decreasing the tenured space. What you do however is reduce the amount of garbage which makes it to tenured space and reduce fragmentation. – Peter Lawrey Oct 20 '13 at 11:57