0

I have a application that has a huge heap (around 100GB), and during initialization it allocates almost all avaliable memory with different caches. The problem is that this initialization phase allocates lots of object that cause a painful de-fragmentation of old gen. So my idea is to force full gc as a last step of initialization phase to align/compact old gen and reduce probability of "Concurrent mode failure" in runtime.

Is there any way of forcing such a collection ?

Thanks

Tomek
  • 121
  • 1
  • 6

1 Answers1

0

Basically, you should run out of your memory and then call to gc should work.

Consider this way http://www.informit.com/articles/article.aspx?p=19703

You can try also this one https://stackoverflow.com/a/6915221/1137529 but I am not sure if it will actually work fine.

Community
  • 1
  • 1
alexsmail
  • 5,661
  • 7
  • 37
  • 57