Does low android storage affect app's performance? - android

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

Related

How to get the read and write speed of android RAM?

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

What special powers does ashmem have?

Can someone explain why ashmem was created?
I'm browsing through mm/ashmem.c right now. As near as I can tell, the kernel is thinking of ashmem as file-backed memory that can be mmap'd. But then, why go to the trouble of implementing ashmem? It seems like the same functionality could be achieved by mounting a RAM fs and then using filemap/mmap to share memory.
I'm sure that ashmem can do more fancy stuff -- from looking at the code, it seems to have something to do with pinning/unpinning pages?
Ashmem allows processes which are not related by ancestry to share memory maps by name, which are cleaned up automatically.
Plain old anonymous mmaps and System V shared memory lack some of these requirements.
System V shared memory segments stick around when no longer referenced by running programs (which is sometimes a feature, sometimes a nuisance).
Anonymous shared mmaps can be passed from a parent to child processes, which is inflexible since sometimes you want processes not related that way to share memory.
Can someone explain why ashmem was created?
David Turner (a regular on Android NDK) answered this in Why was bionic/libc/include/sys/shm.h removed?:
... System V IPCs have been removed for cupcake. See
bionic/libc/docs/SYSV-IPC.TXT for details.
In brief, System V IPCs are leaky by design and do not play well in
Android's runtime environment where killing processes to make room for
other ones is just normal and very common. The end result is that any
code that relies on these IPCs could end up filling up the kernel's
internal table of SysV IPC keys, something that can only safely be
resolved by a reboot.
We want to provide alternative mechanism in the future that don't have
the same problems. One thing we provide at the moment is ashmem, which
was designed specifically for Android to avoid that kind of problem
(though it's not as well documented as it should). We probably need
something similar for semaphores and/or message queues.

To implement a Shared memory manager in C++

I have implemented a simple shared memeory code which is scattered in the two processes(1 acts writer and other acts as reader). But I want manage this SHM code(just like a memory manager),which works independent of any reader/writer processes. By simply giving some hooks/pointers to out side, Can any one suggests me a way for this. or any related code or links regarding related information to this ? One more this Can I use Zygote process to make it happen please suggest ?
An application cannot "share" its memory using plain pointers on a modern operating system. This is something which requires the assistance of the OS, and is highly dependent on the OS in question. For instance, on Linux the best bet would be to use SysV Shared Memory.
Make sure you understand the overhead of multiple process shared memory and ask yourself if just using threads would not suffice. In most cases, threads will suffice, or if not you should re-think your model to use a message passing/shared nothing model.
Have a look at what Boost.Iterprocess can do for you. Especially have a look at the Managed Memory Segments section.

Android app RAM usage

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.

How to find out the memory footprint of my Android App?

Well, the title says it.
It would also be handy to know how many memory is still available.
I am writing a memory hungry application that tends to crash randomly (in native Code),
and my suspicion is that it gets out-of-memory.
I think you'd struggle to find a more comprehensive answer than this on the subject:
How do I discover memory usage of my application in Android?
i agree with hackbod's reply. As far as my understanding goes, your app wont crash , rather it will be killed.
you may find this discussion interesting
Is there a need to check for NULL after allocating memory, when kernel uses overcommit memory.
I guess there is some call back to know lowmemory conditions(onLowMemory()), you can use it to identify low memory conditions, I havent tried it though.
Applications on Android generally don't crash due to low memory. If you are using a lot of memory, you may cause most all other applications to be killed. If you keep on using memory, you may cause the system to kill your app as well (not crashing it, just killing it), though you will probably get to the point of noticeable paging before that happens.
If you are dealing with native code, the more likely explanation is that you are corrupting memory somewhere.
You might want to catch the OutOfMemoryException and then call System.gc() to perform a manual garbage collection, then retry that piece of code that failed. You might be able to use native exceptions with JNI to detect when the C++ code fails due to lack of memory, or anticipate.
Check http://kohlerm.blogspot.com/2010/02/android-memory-usage-analysis-slides.html to find out which java objects use the most memory

Categories

Resources