Android :: Matrix.rotateM Does Heap Allocations
Sep 24, 2010
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.
View 8 Replies
Jul 7, 2010
In my android app, is there any way to get the total amount of memory my application is taking up, in the code. I'm using lots of large bitmaps, so it must include external allocations as well. I must, however, be able to get the number in the code, so that I can dynamically adjust to fit the budget I have.
I also need a way to get the total amount I have available (16Mb or 24Mb) as well.
View 1 Replies
View Related
Feb 26, 2010
I did a dumpsys meminfo of my app and each time I go in and out of my activity the asset allocations grows i.e
CODE:............
Is this a concern? What can I do to avoid this? I have a feeling this is the reason for the growing memory usage.
View 2 Replies
View Related
Nov 11, 2010
I've managed to get my allocations down to next to nothing using DDMS (great tool), this has drastically reduced my GCs to about 1 or 2 every 3 minutes. Still, I'm not happy because those usually cause a noticeable delay in the game (on some phones) when you interact with it.
Using DDMS, I know what the allocations are, they are Strings being converted from integers used to display game information to the HUD.
I'm basically doing this:
CODE:.................
This happens once each frame update and the HUD system is modular so I plug things in when I need and this can cause 4 or 5 hud elements to allocate Strings and AbstractStringBuilders in DDMS.
Any way to reduce these further or eliminate all the String allocations and just reuse a String object?
View 2 Replies
View Related
Aug 3, 2010
I'm trying to use DDMS to track my allocations, but it only finds my activity if I run it on the emulator. If I run my app on my phone it can't find it, even though it finds the phone. Is there anything specific that I need to do that I might have missed?
View 9 Replies
View Related
Apr 1, 2010
I would like to obtain the transformation matrix of an animation to calculate the position of the view that was animated.It seems the Animation class has a method called getTransformation that can be used to obtain the transformation applied to the view.However, if I use getTransformation before starting the animation I obtain the identity matrix.The program enters an infite loop because getTransformation seems to trigger onAnimationEnd (why?).How should I use getTransformation to obtain the transformation matrix of an animation? Is there another way to do this?
View 1 Replies
View Related
Jun 21, 2010
Is there any efficient linear algebra library for android? I need to compute matrices of different sizes(also bigger than 4x4) and rectangular too.
View 1 Replies
View Related
Aug 20, 2010
Suppose I initialize an AffineTransform as below:AffineTransform af = new AffineTransform(2, 3, 4, 5, 6, 7); How would I create an equivalent Matrix using android's sdk?
View 1 Replies
View Related
Feb 23, 2010
I spend two weeks now trying to get this working with no success. Here is what I want to do: I have several geo points around the user and his phone. I want to display this point overlaying them on the input from the camera (kind of standard AR (Augmented Reality) app). Part of my requirements are that the user can use the phone in either landscape or portrait mode.My plan was like this.
1. Register for Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD 2. Pass the result to Sensor Manager.getRotationMatrix(), getting back the R matrix that should be telling me how to translate points from the Phone coordinate system (defined here: http://developer.android.com/reference/android/hardware/SensorEvent.html) to World coordinate system (x -> East, y -> North, z -> Sky) 3. I want to translate points from World to Phone so I take the inverse of R (I'm using Matrix.invertM()) to get R_In 4. Using the GPS I translate the geo points I want to display on the camera to points in the World coordinate system and then I run them through the R_In matrix to get their coordinates in the Phone system. 5. Draw the points in the screen only if the have (phone coordinates) z < 0 and x and y such that they are visible. This is my grand plan... however I have problems quite early (2). I do get the R matrix back and it looks good when I align the phone to the world coordinate system ( I get the identity matrix ). However when I try to translate an imaginary point from the Phone coordinate system say (0, 1, 0) to the World coordinate system I don't get the numbers I expect.
View 2 Replies
View Related
Aug 2, 2009
I got this code from another post and modified it to work for me as a TextView. I tried using the code below but no transformation is happening? I trying to draw the canvas of the TextView with the given Matrix transformation.
import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.TextView;
public class CTextView extends TextView { private Matrix mForward = new Matrix(); private Matrix mReverse = new Matrix(); private float[] mTemp = new float[2];
public CTextView(Context context) { super(context); mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs) { super(context, attrs);
mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle);
mForward.postRotate(90); mForward.invert(mReverse); }
@Override protected void dispatchDraw(Canvas canvas) { canvas.save(); canvas.concat(mForward); canvas.restore(); super.dispatchDraw(canvas); }
@Override public boolean dispatchTouchEvent(MotionEvent event) { final float[] temp = mTemp; temp[0] = event.getX(); temp[1] = event.getY();
mReverse.mapPoints(temp); event.setLocation(temp[0], temp[1]); return super.dispatchTouchEvent(event); }
View 3 Replies
View Related
Aug 7, 2010
Ive been trying to implement a limit to prevent the user from scaling the image too much in my multitouch zoom app. Problem is, when i set the max zoom level by dumping the matrix, the image starts to translate downward once the overall scale of the image hits my limit. I believe it is doing this because the matrix is still being affected by postScale(theScaleFactorX,theScaleFactorY,myMidpointX,myMidpointY) where theScaleFactorX/Y is the amount to multiply the overall scale of the image (so if the theScaleFatorX/Y is recorded as 1.12, and the image is at .60 of its origional size, the overall zoom is now .67). It seems like some sort of math is going on thats creating this translation, and was wondering if anyone knew what it was so i can prevent it from translating, and only allow the user to zoom back out.
View 1 Replies
View Related
Aug 31, 2010
I might be completely off-base here, but I've spent the last two days trying to figure this out and, without success, you're my only hope.What I'm doing is simple:
* I have a canvas where I draw a circle with center on (10, 10), with radius = 5;
* Then, I obtain the canvas transformation matrix
* And then I create a new rectangle, I map it using the matrix and I use the canvas to draw it.
My problem: basically, the rectangle is being drawn in a different position along the Y-axis.I outputed the transformation matrix and, by default, it is translated by zero in the X-axis and by 25.0 in the Y-axis. Please note that I made NO transformations, either translate, scale or rotate. I am unable to understand why this is happening and how to avoid it.
View 3 Replies
View Related
Jun 23, 2010
I have an OpenGL app that manipulates it's geometry in screen space to acheive some effects, and therefore bypasses OpenGL's matrices by setting modelview and projection to identity. For some reason, Android's OpenGL implementation seems to be unhappy with this, and doesn't draw anything. The same app, compiled from the same code base, works fine on windows and on iPhone. If I load the app's projection matrix into GL's matrix, and multiply it's inverse with the final geometry prior to drawing it (which is effectively a no-op) it displays correctly.
View 6 Replies
View Related
Apr 29, 2010
Just wanted to let folks know I put my Incredible under an inspection scope today and confirmed the PenTile matrix layout is present on the AMOLED screen, similar to the Nexus One. Not a big surprise since it's probably the same stock screen acquired from Samsung, but I thought I'd let everyone know for certain. If you're not familiar with the PenTile matrix arrangement:I'll try to get some real high mag pictures, but it's basically as shown in the first link.Picture of the Incredible's AMOLED screen under high mag.
View 2 Replies
View Related
Apr 22, 2012
I am super new and I want to root my matrix 2 on my MacBook pro any
View 2 Replies
View Related
Oct 27, 2009
I noticed when you create an AVD now that you can set an application max heap size. I found that when I did WVGA800 it was set to 24. So it looks like it's more than the 16 we are used to.
I there an API method to get the value of this max heap size? I haven't looked into that yet.
View 4 Replies
View Related
Jun 30, 2009
07-01 11:32:02.192: VERBOSE/QualcommCameraHardware(35): state transition QCS_WAITING_JPEG --> QCS_IDLE 07-01 11:32:02.232: ERROR/dalvikvm-heap(395): 6291456-byte external allocation too large for this process. 07-01 11:32:02.232: ERROR/(395): VM won't let us allocate 6291456 bytes 07-01 11:32:02.242: DEBUG/AndroidRuntime(395): Shutting down VM 07-01 11:32:02.242: WARN/dalvikvm(395): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) 07-01 11:32:02.242: ERROR/AndroidRuntime(395): Uncaught handler: thread main exiting due to uncaught exception 07-01 11:32:02.302: ERROR/AndroidRuntime(395): java.lang.OutOfMemoryError: bitmap size exceeds VM budget My app shut down when i load a jpg file,i can avoid it by call system.gc().But I think memory limit will be 14M or 16M.
View 24 Replies
View Related
Aug 31, 2009
Does the 1.5 SDK still have the 16mB application heap limit? Is there any way to change it? Do you think this limit will persist into the forseeable future?
View 3 Replies
View Related
Nov 5, 2009
what do the following mean in the Heap view of *DDMS*:
1) Data Object
2) Class Object
3) 1,2,4,8-byte *array* : which arrays are we talking about here??
4) non- Java object
View 3 Replies
View Related
Nov 18, 2010
My question may look naive but I do not know how to formulate it more correctly. The problem is that I create and use large simple type arrays in my application.
And I get errors like: ERROR/dalvikvm-heap(1763): Out of memory on a 7907344-byte allocation.
Yes, it's big enough but task management tools claim that my application is using only 30MB of memory, while other at the same time use 50MB and even 110MB (have seen once) and there is still 190MB of free memory in the system (not system applications, just other ordinary applications I have installed). If all applications are provided with the same heap size at startup how can they grow so big?
View 1 Replies
View Related
Nov 2, 2009
I'm an Android game developer and I need to ask you a couple of questions about Android heap limit.
Does the 16 MB heap limitation also applies to OpenGL ES textures or SoundPool sound effects? Since they are managed by native code, is it correct to affirm that there is no problem in using more than 16 MB of RAM in app/game resources/assets? If it is possible right now, it is guarantee to be possible in the future?
View 3 Replies
View Related
Jan 15, 2010
I am working on an application for android and we since we have lots of graphics, we use a lot of memory.
I monitor the memory heap size and its about 3-4 Mb , and peeks of 5Mb when I do something that requires more memory (and then goes back to 3). This is not a big deal, but some other stuff is handled outside the heap memory, like loading of drawables.
For example if I run the ddms tool outside eclipse, and go to sysinfo, I see that my app is taking 20Mb on the Droid and 12 on the G1, but heap size are the same in both, because data is the same but images are different.
So the questions are: How do I know what is taking the memory outside the heap memory? What other stuff takes memory outside the heap memory? Complex layouts (big tree) ? Animations?
View 2 Replies
View Related
Jul 17, 2010
So from my understanding each application normally gets 16 mb memory to work with. This is what is shown on the heap tool for eclipse:
Heap Size: 4.5 mb
Allocated: 3.2 mb
Free : 1.5 mb
Used : 66.7%
Which one is the total memory being used? Heap size, or Allocated?
View 1 Replies
View Related
Apr 7, 2010
I'm using Matrix 0.6 rom,and it's AOSP based, so it had landscape launcher and android keyboard. I was successfully able to pull the .apk for the keyboard, and install it on a different rom, but for the launcher, it failed. Anyone have any ideas?
View 6 Replies
View Related
Apr 24, 2010
its very cool and its free in market.. think you need villain 5.3 to run live wallpaper though.
View 6 Replies
View Related
Jan 7, 2014
I recently bought tablet Matrix d7030. where to download latest firmware for it or if I could use firmware of another device. how to root this specific tablet?
View 1 Replies
View Related
Dec 25, 2012
I'm having with my Matrix One tablet. I'm getting an exclamation mark inside of a triangle, inside of a battery icon. The issue started after I let the battery completely die out. I can't get past that screen. When pressing power the battery icon shows up and the tablet shuts down a second later. I tried all button combinations to get into recovery, nothing worked. I've also tried charging the tablet.
There was one thing I managed to do, that was get the tablet to show up on my computer. I held down the update button with a needle and then held the power button until a blue light indicating the tablet was on showed up. The screen was black but my computer detected a new device. My computer didn't find any drivers for the tablet, so I went in search of them myself and couldn't find any. My tablet is A10 compatible, but none of the A10 drivers I found seem to work on my tablet when I go to manually update it through device manager, neither does the PDAnet method I found online.
I was able to find a recovery that works on my device, one that will allow me to reset my tablet, if I'm able to boot into recovery after I get it on my tablet. Now in order to even test the other recovery I need drivers for my device so ADB can detect it and I can push the recovery. My device is already rooted with Superuser updated to the latest build.
I'll add that I've even taken the liberty of opening up the tablet to see if I can disconnect the battery from the board to cut all power, as I'm unable to do that because the batteries are connected by soldered red and black cables.
View 1 Replies
View Related
Oct 15, 2009
I have an app which does a bunch of image manipulations, and those images are ideally full-screen sized. It works on a G1 (or HVGA emulator), but runs out of memory on a WVGA emulator instance, because full-screen images use twice as many pixels. Fine, I can work around it by manipulating smaller images, then scaling up to WVGA at the end. There's some loss of image quality, but this is unavoidable on a WVGA device with a 16MB heap limit, so I'll live with that.
When a real WVGA device hits the streets in the next couple of months, though, it's likely to have more than 16MB heap per app, for just this kind of reason. So for best image quality, I'd like my app to adapt to this situation, and use full-screen-sized images on such a device. IOW, I'd like to implement a heuristic which sets the image size based on heap size.
In order to do so, however, the app needs to know what the maximum heap size is, and I haven't yet found an SDK call which will return this information. The various Debug.get* memory calls all seem to be to do with how much heap you have *allocated*, not how much you theoretically *can* allocate. I understand that this isn't necessarily a hard number, that issues like fragmentation and GC mean that you may not actually be able to allocate every last byte, but a theoretical number would still be useful.
Can anyone point me to an SDK call I've missed?
View 4 Replies
View Related
Aug 10, 2009
I know that's a subject which was discuss a lot of time and I try to find a solution since more than 6 day for the memory leak which appears in my application.
I've read this page: http://www.curious-creature.org/2008/12/18/avoid-memory-leaks-on-andr...
So, I don't use static member fields, I always use recycle() and I don't use inner class.
My application use a gallery and some bitmap. I use finalize to monitor garbage collection in each class of my application: protected void finalize() throws Throwable {try {Log.d("FINALIZE", this.toString());} finally {super.finalize();}
View 2 Replies
View Related
Mar 3, 2010
I could set minimum heap size in the source code like below.
--> VMRuntime.getRuntime().setMinimumHeapSize(INITIAL_HEAP_SIZE);
But I want to set this value in android.mk or androidmanifest.xml.
View 7 Replies
View Related