rotateM() just does the following:
float[] r = new float[16];
setRotateM(r, 0, a, x, y, z);
multiplyMM(rm, rmOffset, m, mOffset, r, 0);
You can create your own rotateM() method and use your own float[16] do
not allocate every time.
On Fri, Sep 24, 2010 at 3:30 PM, A Curious Developer <[email protected]> wrote:
> Are you meticulous in removing all per-frame heap allocations from
> your game? (At least the allocations that you can control and that
> have practical alternatives.)
>
> While trying to reduce per-frame heap allocations from my running
> game, I found that method
>
> android.opengl.Matrix rotateM(float[] m, int mOffset, float a,
> float x, float y, float z)
>
> does a heap allocation. This means maybe 10 or so extra heap
> allocations per frame and is the only per-frame allocation left in my
> application (well, the only one that I can directly control). I am
> thinking of replacing this with my own version - one that does not do
> any heap allocations.
>
> I also had some lists that I replaced with my own list implementation
> because I found that some standard list iterations would create new
> iteration objects, putting more pressure on the heap and forcing more
> frequent garbage collection.
>
> I know that I can't eliminate all the heap allocations. In particular,
> input seems to trigger a bunch of allocations.
>
> I can't help but think that anything reasonable I can do to reduce
> pressure on the heap will improve the user's experience (if garbage
> collection is going to stall my game). Obviously there are diminishing
> returns at some point, so ultimately I have to make a judgement call.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
Romain Guy
Android framework engineer
[email protected]
Note: please don't send private questions to me, as I don't have time
to provide private support. All such questions should be posted on
public forums, where I and others can see and answer them
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en