www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: raft on December 13, 2010, 06:47:49 pm

Title: memory and gc
Post by: raft on December 13, 2010, 06:47:49 pm

this is a bit annoying: according to my tests, the less objects you create, the less frequently dalvik garbage collects. but when it does, it collects many objects at once and hence the delay gets larger. kind of dilemma :-\ my gl thread's priority was 8, i left as default (5) but that didnt help.

anyway, inspecting memory allocations (http://android-developers.blogspot.com/2009/02/track-memory-allocations.html) i've spot some methods. it may be worth improving them:* Camera.lookAt creates a new Matrix all the time. instead using an instance field may help* Camera.getPosition() is used frequently, so it may be worth adding a Camera.getPosition(SimpleVector) method

I don't get it...there is no reference to getWorldTransformation() in transformVertices() according to Eclipse and according to my eyes (which doesn't mean much...). There is a call to getWorldTransformation(<Matrix>) for objects that have lazy transformations enabled, but that's all... ???

allocation tracker does not display method signatures but only method names and line numbers. see below.

according to this getWorldTransformation(?) creates a Matrix via Matrix.cloneMatrix(). but as i said it's not that frequent.. it's ok ;)(http://img258.imageshack.us/img258/6941/screenshotdebugeclipse.png)

That should happen only once per object if the object uses lazy transformations. From there on, the created matrix should be recycled even when disabling lazy transformations for some time. The logic to support this is a bit twisted, so i may have overlooked something...

ok then no problem :) this allocation tracker thingy does not print how many times an object is created (at least i cant read it) it just prints some messages many times (number of times cant be creation count but maybe a proportion). i can say this Matrix creation is relatively low as you said.