I have just made an app for Android phones. It is a rather simple app, yet it uses up to 25 MB RAM.
Not to get any answer to this specific app but in general what is using a lot of RAM in android?
(I know this is a rather broad question, but I was just wondering)
EDIT
What i mean is if one should use arrays rather than ArrayList, use private Class when possible and so on.
Update
I have now made the RAM usage a little smaller (half). I have made String final when possible and created a public class instead of a inner private class. (don't know if this it what caused it).
Update
I now found the BIG RAM eater. I had some ImageViews, which were referenced a picture in the picture gallery via an URI path.
So my question have change: new Question is here:)
but in general what is using a lot of RAM in android?
Bitmaps. It is difficult to run out of RAM unless you are using lots of bitmap images or doing something that should be blindingly obvious as a potential RAM issue (e.g., loading 10,000 records out of a database).
You can dump the heap using DDMS and inspect it using the Eclipse MAT plug-in, if you want to learn more about what is going on inside your app's RAM.
I would review your application against the guidelines listed in the Android Developers Dev Guide.
Not being aware of certain recommended practices could result in heavy memory usage by your app.
Related
Good day.i wanted to know if android storage low,does it affect an app performance?Because same app is fast on another device and same is pretty much lagging on another one which has like 2GB of free memory from 12GB of memory.So they both on same device and i just was wondering should it be considered to the lack of storage or its something wrong with my app?
2 GB of free memory (what you have) is good enough for any small or mid-sized app to perform alright. Problems may occur it the app is highly resource intensive and has a lot of run-time graphics load/unload. You should try checking and optimizing your app if it falls under the first category.
Here are a few official performance tips that might help you: [Link]
Avoid Creating Unnecessary Objects
Prefer Static Over Virtual
Use Static Final For Constants
Avoid Internal Getters/Setters
Use Enhanced For Loop Syntax
Consider Package Instead of Private Access with Private Inner Classes
Avoid Using Floating-Point
Know and Use the Libraries
Use Native Methods Carefully
Use Native Methods Judiciously
I have been searching for this answer for days and can't find a straightforward answer. I am working on an application written in C++ and that has been ported to Android. I am able to launch and run without too much hassle. My task is to figure out how much RAM our app is using dynamically so that we can handle memory issues dynamically-- which in my mind means that I need to have something in my C++ that can somehow be aware of system characteristics. What I have been able to do, is in my Java code, I can pull certain metrics that belong to my app via the getMemoryInfo call. Like in this post: Programmatically find Android system info
However, I would really like to be able to probe this from our C++ code so that we can handle everything in there...
Is this even possible?
If it is, are the calls unrealistically expensive?
If it is not, how is it possible to manage your memory through the native code rather than the Java code? i.e. If I see that I only have x amount of RAM available, I can dynamically change how much memory I want allocated to something in my C++ code to accommodate what the system has to offer.
Something along the lines of:
Ex. C++ Code:
if (android.os.thisApp.RAM left < 20 )
allocate 10M
else
allocate 20M
I need to test the performance of android's ram. How can I get the read and write speed of android RAM.
Since I have root authority and busybox, the method can be a bash shell or an android app.
Thanks.
You will need to write your own benchmark, or look up the statistics on benchmark providers such as PassMask Android. Benchmark writing involves a lot of methodologies (rules to be followed to get a correct, meaningful, and reproducible result.)
Measure memory speed doing what? It depends on what instructions are handling the data and whether the access is sequential or random (or backwards). It can also vary with multithreading using one or multiple cores. The following has results of my three Android memory benchmarks (and links to MP results). These might help in deciding what to do.
http://www.roylongbottom.org.uk/android%20benchmarks.htm#anchorStart
I looking a tools that can be helps for me to measure my performance in some parts of code in my android application.
Is there any tools for help me?
Now i was written a class that measure my functions in app, but may be is exist more effective methods?
I'm not sure if you are looking for a tool to instrument your code and review your stack trace execution time or something more related to different metrics, but maybe I can help. I'm working on a tool we will release soon, this tool will allow us to monitor our application performance in production using real-time stats. The platform is named FlowUp http://flowup.io/. Just adding an Android library to your project you could monitor your application in production in real-time :)
Using FLowUp you can get information about your application performance in terms of:
Frame time.
Frames per second.
Network consumption.
CPU usage.
Disk usage.
Memory consumption in terms of load and bytes allocated.
And much more metrics. Of course, all these metrics can be reviewed crossing this information with some tags related to the application or the device. For example, you could get information about the network consumption or the frames per second of your app per activity and comparing different app or Android OS version.
This is an screenshot I've taken from our landing page:
Right now we are under development but I recommend you to subscribe to our mail list in http://flowup.io to have access to the first beta we will release soon :)
If you have any metric you'd really like to monitor, please don't hesitate to request it! Maybe we can implement this for you :)
Sure there are tools for that. Try this: Android Systrace.
My team is on its way to create our first game for Android and we're discussing a lot of things concerning the game's development. We've got one person which will test the game throughout the whole process. Usually, during the testing process, we give the tester an access to configuration file which contains a lot of constants that are used in the game.
But on Android, however, everything is deployed to an .apk file. Therefore, we cannot simply let the tester edit a traditional configuration file for testing, because the whole package needs to be rebuilt. It makes the tweaking process a lot less comfortable. Should we then create a function which would read a plain text file from a strictly set location (on phone or sd card) or can you think of any better solution? How do the other companies in Android games industry do it?
What is more, I'd like to mention that we will be developing the game with Marmalade - so if there's a solution that is especially good or bad while using Marmalade, please take it into account.
Thanks in advance.
I guess you could set all your constants in a SharedPreference object. This way those constants would be both user-editable (with a default value) and saved between two runs.