• Advertisement
Sign in to follow this  

Java garbage collection - waits for idle time?

This topic is 1657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.. 

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement