jPCT-AE - a 3d engine for Android > Support

Garbage collection

(1/1)

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

Navigation

[0] Message Index

Go to full version