Garbage collection

Started by Thomas., September 29, 2012, 08:39:25 PM

Previous topic - Next topic

Thomas.

How can I optimize code for Android garbage collection? GB takes every 5 seconds about 70ms...

EgonOlsen

Create less garbage... ;)

Regarding jPCT, make sure that you are using the methods that take the return value as parameter where possible (like getTranslation(<SimpleVector>) instead of getTranslation()).

Thomas.

#2
Thanks, these methods helped ;) I checked whole my code and there also were a lot of garbage. GC is called every 7 seconds, now. My measuring shows, that the largest memory allocation causes calling method checkCollisionEllipsoid(). Is there any possibility for optimization this method?

EgonOlsen

No. Object creation of this method has already been reduced to the bare minumum. You can avoid some additional object creation if you don't use collision listeners, but that's about it.