Emulate limited resource device android - android-emulator

I am trying to find a NullPointerException that I get when in my app the phone release memory. I was testing on a Samsung G3, but now that I have change for a GS2 which has more RAM memory, the variable is still there when I minimaze/maximize.
Is there any way to simulate my old phone and his limited RAM memory? A bit ironic,but now I miss it...In the SDK emulators I can set SD card size, but not the RAM, which I guess is the key problem here.

There is a program on the android market called CPU Master. You can set CPU speed so then you can test your program as in a phone with limited resources.

Related

Create AVD with Eclipse: Memory Options, Internal Storage, SD Card

I am creating a new AVD within Eclipse, Android dev. tools 21.0, and it would be great to have some explanation on
"Memory Options" (RAM and VM Heap), "Internal Storage" , and "SD card".
(I am sorry but since I am a new user I am not allowed to post a snapshot image)
I would need:
- the meaning
- the unit of measure (for RAM and VM heap are not displayed)
- criteria to choose the values
Thanks
First to clear up some possible confusion, Eclipse doesn't exactly have its own AVD creation mechanism. It has a plug-in which calls the Android Vitrual Device Manager. The AVD Manager can also be accessed from the command line using "android avd", and comes as part of the Android SDK (so this question isn't specific to Eclipse users).
As for the definitions:
Internal storage
Built-in, non-removable file storage capacity. The operating system and most apps will be installed here. When you see a device advertised with 8GB or 16GB, this is what that number refers to.
The AVD Manager allows you to select Gigabyte or Megabyte.
The choice is up to your needs and the amount of space you have on your hard drive, but you'll probably want a bare minimum of 200MB. 2GB will probably be more than enough. If you run out of space you can always add more or move files to the SD card.
SD card
Similar to Internal storage, but refers to the storage an Android device would have access to on a removable memory card (the same kind of card digital cameras use). This is the place for storing user files, including documents, music and video, but some applications are built to be stored here.
The AVD Manager allows you to select Gigabyte, Megabyte, or Kilobyte.
Again, this uses space on your computer's hard drive, but this value is completely optional. You can safely leave this blank until you need to test how your app uses external storage.
Memory Option- RAM
Available working memory, used by the operating system and any running applications. This directly affects how many apps can be loaded at the same time.
The AVD Manager expects a value in MB.
This uses your computer's RAM, which is a limited resource so you don't want to use too much. I'd say the current range to play with is 256MB to 2024MB, so your sweet spot is likely either 512 or 1024.
Memory Option- VM Heap
This is a more advanced topic which is way out of scope of a beginner question. For simplicity's sake I'll just say that where RAM is related to the sum of running apps, Heap is related to an memory available to each individual app.
The AVD Manager expects a value in MB here as well.
For a reasonable value, refer to this question which lists real-world values: Android heap size on different phones/devices and OS versions
For much more information on memory, refer to the Android Developer site (http://developer.android.com/training/articles/memory.html)

Android Virtual Device not working

I have read a lot of complaints and problems about Android Virtual Device (AVD) taking a lot of time to load, but people were often talking about just few seconds delays.
In my case, it takes about 15 minutes(!) to load, and even then it also freezes or reacts very slowly. I have already un- and reinstalled once, but nothing changed.
I also have problems with Eclipse, but I am going to post a separate question for it.
I am running it on a slightly old PC, with Intel Core Duo CPU, 2 GB RAM, plenty of HD space, Windows XP SP3.
Do you think the problem is in having too little RAM? Is there a log file somewhere that can help me in understanding what is going wrong?
Thanks
2GB RAM is not much, but you should be able to run the emulator with it. Try to close as much other programs as possible before starting the emulator.
It is my experience that the AVD startup time increases with the amount of virtual hardware you add to the AVD, so keep this simple. Also I noticed that Android 3.0 or higher AVDs can be rather sluggish in the emulator compared to the 2.x versions. However, their performance might improve if you increase the "Device ram size" and/or "Max VM application heap size" hardware properties (see also this post)
I found some other tips in this post but I didn't try them myself.
If you have Eclipse up and running you can check the logcat while the AVD is starting.

Limits of memory use on iPhone

I want to know the feasibility of these things:
1) Is it possible to download 200MB audio files to our application?
2) How much RAM can be accessed from an iPhone app? What is the largest amount of RAM an app can expect to use?
Anyone's help in this regard is deeply appreciated.
Thanks to all,
Monish
1) Yes, although you might make users angry who are not on Wifi + fast DSL. Also you will need to handle interrupted downloads.
2) No, since ARM is a 32bit processor a maximum of 4GB RAM can be addressed. Anyhow, iDevices have a maximum of 512MB right now (iPad 2). Your application will get killed by iOS if your app takes about 75% or so of the available RAM which means in reality you shouldn't use more than, say, 80MB of RAM. And if you need to address 8GB then your design is totally flawed to begin with.
There are always ways to work with a lot less (e. g. either by using better algorithms and/or by caching to disk). On the disk, you are only limited by the available space left on the device. So if you have an iDevice with just 8GB you're naturally out of luck as the system itself and other apps/data are reducing the available space. Same if you're on a 64GB iDevice which is packed with movies. You will need to be able to work with the space that is available. You can, for example, try to "reserve" the necessary space by creating a file and making it as big as you need it (via a seek and a write) but be prepared for angry customers.

Memory allocation testing between two devices

I am testing my app in two different devices. My app is relies heavily on images(allocating and deallocating). I know I have a leak but I am just curious why I observe this.
The behavior between the two devices is different. Device A crashes after 4 cycles of switching between views and Device B after 10 cycles, yet Device A has more free memory than Device B.
Device A: Device B:
Type iPhone 3G 16GB iPhone 3G 8GB
Capacity 14.64GB 7.08GB
Audio 5.32GB 1.18GB
Video 48.8GB -
Photos 267.3GB 46.8GB
Apps 1.08GB 505.5MB
Other 343.9MB 370.7MB
Free 7.60GB 5.0GB
Any insights why this is the case?
I am not sure if I understand this correctly, but the figures on the last row (7.6/5 GB) refer to available flash memory, not to the RAM. Therefore they say nothing about the expected performance of a memory-intensive application. Neither the amount of free RAM is exactly telling, because the system will start killing large applications when the memory is scarce and the amount of free memory will go up.

iPhone maximum capacity

My iPhone app will download a large amount of data from a remote server. What is the maximum amount of data that an iPhone application can store? If you try to store too much data, what happens?
Like a computer, iPhone has RAM and hard disk space. The disk space is advertised on the box (8GB, 16GB, or 32GB). Apple does not advertise the amount of RAM, but the iPhone and iPhone 3G have 128MB and the 3GS has 256MB.
If you fill up memory, your app will receive a Memory Warning notification. If you don't free up enough memory, your app will be terminated.
If you fill up the disk, your app will probably receive disk full errors when you try to write more data.
See this excellent article on memory on the iPhone.
When you first buy an iPhone it will say 8GB, 16GB, 32 GB, or 64 GB on the package. Usually they use 3 GB for something that I don't really know what for. My iPhone 4S has 64 GB on the package but on the usage settings it says that I have 62 GB still a lot but I think that apple uses some GB for some kind of settings. I Hope this Helped :)