Jump to content

  • Log In with Google      Sign In   
  • Create Account


Java garbage collection - waits for idle time?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 voodoodrul   Members   -  Reputation: 130

Like
0Likes
Like

Posted 11 July 2013 - 08:37 PM

So I have a LWJGL renderer. It spends all of it time rendering. Imagine that. It seems that garbage collection waits until the last possible second to run and it's becoming problematic. Even triggering a System.gc() request to perform GC doesn't seem to help. If I stop moving around in my renderer, which won't need to create new large objects, it eventually seems to clean itself up.. 

 

Should I deliberately halt the renderer, for maybe 100 msec, to convince java to perform GC? 

 

Profiling my app doesn't seem to help much. I see a metric crapload of object allocations, but that's not "objects that are still alive" and looking at the heap doesn't show an obvious memory leak.. 



Sponsor:

#2 TheChubu   Crossbones+   -  Reputation: 3727

Like
0Likes
Like

Posted 11 July 2013 - 08:49 PM

I think it waits until it runs out of heap space. Less heap space -> more garbage collection. I don't remember exactly right now :D

 

Here are some videos that you might find useful:

 

http://www.infoq.com/presentations/Java-GC-Azul-C4

http://www.infoq.com/presentations/JVM-Mechanics

http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter?utm_source=infoq&utm_medium=related_content_link&utm_campaign=relatedContent_presentations_clk

 

Last one isn't as useful (its kinda "big enterprise systems" oriented) but it has some good information nevertheless.


Edited by TheChubu, 11 July 2013 - 08:49 PM.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#3 LorenzoGatti   Crossbones+   -  Reputation: 2516

Like
0Likes
Like

Posted 12 July 2013 - 02:44 AM

You should use advanced JVM options to tweak garbage collection, unfortunately requiring so many experiments (at least 4 different garbage collectors, each with many options) that tests need to be fully automated. The objective should be a steady state in which actual memory use is constant and there are many cheap GC operations, e.g. once per frame, to reclaim short-lived objects.
Produci, consuma, crepa




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS