How much memory is my iphone app using (from Simulator) - iphone

I know this has something to do with Instruments, but well it's kind of confusing and searching for Instruments on Google doesn't help much.
I'd like to know how well my app runs, like how much memory it uses. I just don't know where to find something like:
"As close as we can tell from the simulator you'll app will currently be using xx MBs of RAM on a real iphone device."
I need help on how to get this information.

You shouldn't test your memory usage in the simulator for a number of reasons, some of which are:
The simulator is running on your computer, not the phone, so the maximum amount of memory is the same as the amount of ram you have installed in your Mac.
The simulator, and your app when build with the simulator SDK, do not use the same libraries as they would on the device, and as a result, could use a different amount of memory.
However, if you can run on a device, you should use the Memory Monitor and Object Allocations instruments in Instruments to monitor your memory usage.

You should use the Run/With Performance Tools/Object Allocations. The graphs will show you the memory used.
And then you check the box "Created and Still Living" to know what objects are in memory.

Related

iPhone is faster than Instrument tool's memory leaking check tool speed?

Currently i don't have an apple developer account ($99).
I am developing iOS app with searching function in iOS Simulator.
In simulator my app's search speed is not bad, just normal.
But when i check my app for memory leaking with Instrument tool, my app's search speed is too slow and data load speed are also too slow.
I have to load 30 MB data in Start of app.In Simulator it's fast.But in Instruments , it's too slow and also took 6 seconds.
So i am worring about my apps to run on physical devices because of speed.
I would like to know , Is the iPhone physical device faster than Instrument tool's check memory leaking?
In my experience, normal execution on iPhone is much faster than profiling with Instruments. But, that heavily depends on the application and what "instrument" are you using. If your application does a lot of memory allocations, it will be very slow when using Instruments with "Allocations" settings.
But also be prepared, that the iPhone Simulator is usually much faster than the real device. Your desktop CPU is usually x86 and over 2 GHz, but the device's parameters are lower. And also the architecture (ARM) makes the code to be compiled into more instructions than on x86, which also makes it a little bit slower.
Anyway, you really should just go ahead, buy the developer account and test your app on the device, there's no other way to predict the performance. I guess the rule in your situation should be don't guess, measure.
Please dont guess anything test on real device go an buy $99 developer account. iPhone Simulator is usually much faster than the real device. Its a very bad idea to download 30 MB of data at the start. If connection is slow it will take more than 5 min. If your data on device goes more tnan 45 MB apple will kill your applicationa nd free the data. Make sure you are doing in write way.

Memory Usage - iPhone

I was wondering, what is the most accurate way to test how much memory my game application is using on the device? I've been using Instruments with Allocations and Leaks, but the highest it has ever been is 2.22MB (don't get me wrong I'm not complaining at all). Is that accurate? Is that even possible for a game? I use A LOT of images (mostly sprite sheets). Also, when I test it in the simulator it says my application is using 22MB+. I'm just confused. I thought it would be either using the same amount on an actual device or more.
Thanks
Run your app on the device with the Activity Monitor instrument. That should give you an accurate reading of memory usage.

How much memory can an iPhone app use?

Can anyone link me to a page that describes memory allocations for iPhone apps.
I have heard that you are limited to a sandbox of ~20 megs, depending on the state of the phone, but I can't find the source for this.
It depends on the device you're using. I've found that with an iPhone 3G, when the total memory your app is using goes over 10-14MB, it's vulnerable to crashing. When it hits 20MB, it will crash for sure.
As far as I know, Apple doesn't give any hard figures for the memory that you can use. It's always changing so it's hard to pin down. They recommend that you rely on memory warnings and respond to them appropriately.
iPhone 3GS has a much higher amount of memory available to apps (I've heard that it's around 4 times). Although the iPhone 3GS only has double the memory of the iPhone 3G, a lot of that memory is taken up by the OS. There's very little left for apps to run in. That's why the 3GS will allow apps to use so much more memory.
Also, there can be a lot of memory already in use by the OS. One example is when safari is keeping a lot of tabs open. This is why lots of games recommend that you restart the device if it crashes a lot.
When you're programming, keep an eye on the increase of memory (due to not properly deallocating objects) and the peak memory. This problem is more about real-world testing (on as many devices as possible) and good programming practices.
Here's an article to ready more about how to deal with memory problems:
http://akosma.com/2009/01/28/10-iphone-memory-management-tips/
This tool finds what is the maximum memory capacity of any iOS device. It also can also find at which memory level you received the Low Memory warning.
here is the link: https://github.com/Split82/iOSMemoryBudgetTest
It depends on current device state. Some native iPhone applications can run in background and waste device resources(Mail, Safari, Sms, Phone...) So, it's hard to say how much memory u will get...Ideally, your application should stay within 10-12Mb limit to successfully overcome any memory issues.
I believe it's
Memory warnings at 20MB
Application "crashes" at 30MB
I'm fairly certain I saw this in The iPhone Developer's Cookbook: Building Applications with the iPhone SDK by Erica Sadun (amazing book, btw).
Also: Duplicate -> Maximum runtime memory available in iPhone and iPod?.

iPhone: leaks from other Apps taking up RAM?

I'm reading some people stating that if another (3rd party) app on someone's iPhone has been leaking memory, that this may reduce the (mystery) amount of RAM your app would otherwise have available.
This confuses me -- does not all app memory get released when the app is closed by the user? And only one app is open at a time on iPhone?
Normally, any memory that your application allocates will be freed when it exits. However, many of Apple's applications continue running after they're "closed", so memory leaks in Mail, for instance, can affect available memory.
In addition, there are apps out there that claim to free up allocated memory. They really don't do anything other than force some dirty pages out of the buffer cache, but they appear to do something, so people believe they must be doing something useful.
On a jailbroken phone - yes, third party apps can be running at the same time as yours. Running out of memory is common with people who like to have many apps running at once hence the need for task managers, killing tasks etc.
On an unhacked phone - no. Yours is the only non-apple app that is running, no others can run at the same time.
So what can you do? All you can do is try to use the minimum memory possible which you're probably already doing. Realistically you can only test with a factory, unhacked phone, unless you are going to spend hours trying to please everyone. If you think you are maybe using too much you could identify the larger allocations using the instruments tools ("Run with performance tool >" from within Xcode) and then post that chunk of code here to get ideas of how to reduce it.
You should run Instruments and then add the instrument "Memory Monitor" to see the memory use of all of the other processes on your phone. (Add with Window -> Library , then drag the Memory Monitor instrument to the instrument panel.
What I'm still trying to determine is why is iOS releasing memory from MY app, and not all of the other memory pig apps that are not currently running.

Xcode Instruments: peak RAM of iPhone apps running in Simulator?

Is Activity Monitor (a.k.a. Memory Monitor) the only tool in Xcode Instruments that can measure the total app RAM usage of an iPhone app running in Simulator? Just that line showing momentary wired RAM?
And how accurate is that versus iPhone hardware, especially given OSX paging i/o to VM?
I'm seeing 7-8MB wired RAM figures for just the default Xcode iPhone project templates (other than OpenGL) compiled and running. At the same time Object Allocations shows well under 1MB for all objects.
Nope, there's a much better way to do it.
Go to the Run menu and select Run with Performance Tool then Object Allocations.
This will start Instruments and will show RAM usage. It's also useful for detecting memory leaks if you choose Leaks instead of Object Allocations.
I would agree, since the Simulator is just an "API simulator", the behavior you see is going to be at least somewhat dependent how OS X manages memory. And the restrictions are obviously different, for example you can exceed 128 MB of ram, or even 256 MB, which obviously isn't possible on any current iPhone or iPod Touch (at least, as of this writing...).
I've still found it useful in OpenGL for making sure textures and other items are properly deallocated, but beyond that, it's just a rough guideline.
However, if you want to see memory usage on device, there's a simple enough solution. Just target Device in Xcode, and go to Run > Run with Performance Tool > Object Allocations, then the build will be sent to the device and the Object Allocations tool will pop up next to Xcode and show on device memory usage.