You are correct, at least with the current GC.

On Fri, Sep 24, 2010 at 3:44 PM, Leigh McRae
<leigh.mc...@lonedwarfgames.com> wrote:
>  I would have thought this stuff would be in native code.  Having an
> allocation in a matrix operation is basically unacceptable.
>
>
> On 9/24/2010 6:32 PM, Romain Guy wrote:
>>
>> 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<imdb...@yahoo.com>
>>  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 android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>>
>>
>>
>
> --
> Leigh McRae
> www.lonedwarfgames.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to