Maximum size of document directory in Iphone? - iphone

I need to store images and videos in document directory,So i want to know that maximum how much data i can store in document directory that it will not give me memory warning.
Can anyone tell me maximum data storage possible for document directory in Iphone?

I think there is no limit to the size of your sandbox other than the
remaining capacity of the device itself.

According to apple..
To manage program memory, iPhone OS uses essentially the same virtual
memory system found in Mac OS X. In iPhone OS, each program still has
its own virtual address space, but (unlike Mac OS X) its usable
virtual memory is constrained by the amount of physical memory
available. This is because iPhone OS does not write volatile pages to
disk when memory gets full. Instead, the virtual memory system frees
up volatile memory, as needed, to make sure the running application
has the space it needs. It does this by removing memory pages that are
not being used and that contain read-only contents, such as code
pages. Such pages can always be loaded back into memory later if they
are needed again.
If memory continues to be constrained, the system may also send
notifications to the running applications, asking them to free up
additional memory. All applications should respond to this
notification and do their part to help relieve the memory pressure.
For information on how to handle such notifications in your
application, see “Observing Low-Memory Warnings.”
so there is no size limit as such...

The links bellow may be of some help:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/4083-limit-restrictions-filesize-filecount-app-folder.html
https://discussions.apple.com/message/7599983?messageID=7599983#7599983?messageID=7599983

Related

Appropriate Link saying Memory limits of App in iOS

I am developing an Application for iPad & it consumes 5.5 MB at max on RAM of the iPad. I have ensured all this stuff using Instruments number of times. As soon as App uses little bit more memory, It throws memory warnings & app start behaving abnormally.
I have implemented the lines of code for freeing the memory in did-receive memory warning.
I also have ensured that NO LEAKS in the entire app.
I came to know that App needs at-least 6 mb memory.
Here is the general flow of the app.
log in -> 1st-list View -> 2nd-list view -> 3rd-list view -> 4th-Map & listview -> 5.Map&List
brief of each screen.
log-in - simple screen with username-pswd, making a web-service call & authenticating user
based on result of authentication, it will fetch few more data & list it on 1st-list View screen.
based on selection from 1st-list, app will load list on 2nd-list view
based on selection from 2nd-list, app will load list on 3rd-list view
based on selection from 3rd-list, app will load list & map will have pins relatively.
based on annotation from Map, app will navigate to another maps & different pins.
Here, app receives memory warnings on 6th screen. I have ensured all coding standards & all importance of all objects.
In Above case, All screens are very necessary, I am using Navigation Controller & just pushing view-controllers one by one. no duplications - ensured twice.
Now, the point is, App is being tested on iPad-1 with iOS 4.1 & all apps are forcefully closed before starting the testing of the app.
THOUGH, app receives warnings # just 5.5 mb usage.
I tried to convince my project managers that, this amount of memory usage is high & they are asking me - there should some option to set MEMORY. How this kind of High Graphics games & apps are running smoothly ?
I can't find appropriate document from Apple saying LIMIT. I have no answer to them.
If setting Memory limit is not possible, I am requesting you to provide Appropriate PROOF link, so that I can show it to my Project Manager.
If that kind of settings is possible, I am highly eager to know how to make that.
I doubt you will find any positive statement about memory limits for an app under iOS coming from Apple docs.
But if you google "ios app available memory" you will find a lot of information; e.g., this S.O. thread.
In my experience, my apps can sustain a "peak" memory usage of about 20MB (depending on the device state), but then memory use must quickly go well below the 10MB threshold for the app not to be killed (I would say that 6-8MB is more precise figure). Sometimes an app can be killed just because a peak cannot be "undone" fast enough.
One piece of information that might be useful for your managers is the output from the "Memory Monitor" tool in Instruments, specifically the "free physical memory". If you use it, you will invariably see that your app will be killed when the "free physical memory" goes below a given limit (as per Instruments output), approaching zero left memory.
Now, whether that limit is reached because you allocated some memory (which is reported by the Allocations or Leaks tools) or because of other factors (a framework loaded into memory? something in the iOS kernel or that is not tracked by Instruments?) you cannot know. But for sure you can follow how the free physical memory in the device varies over time with the use of your app.
Hope this helps.
The first generation iPad has a total of 256 MB of memory. Of course some of that will be used by the operating system itself.
It's very conservative to assume that at least 64 MB would be available for your application. So 6 MB sounds pretty minimal to me. There must be something your application is doing that causes more memory to be allocated.
There definitely isn't some "I'm a game let me use more memory option". All applications are allowed to use as much memory as they can (though it's always a good practice to minimize memory usage). If memory runs low, the application is notified, and if memory is exhausted, the foreground application is terminated.
If your application is terminated, examine the crash log to see how much memory it was using. My guess is that you'll find you are using more than you think.

How much maximum "disk space" of an iOS device should be used while writing files from code?

We tried to check how much maximum memory is allowed to use while writing file with code, for that we used following procedure:
We loaded video from itune to device to fill memory of device(it shows memory available 0.01 GB)
The we wrote code to download video, before loading video we check how much memory is available(by code) and it shows 175MB.
Now we load video of size 16.70 MB and it allows us to write that video in document directory
But now when we see, our device in itunes it shows warning about extensive use of X MB of memory(i forgot the exact figure).
So my questions are:
How to put a check that my application stops using device memory extensively?
And when (on what amount of memory) we should put that check?
Dont put any check, the amount of memory you used is not a static value, it could vary depending on alot of factors.
What you have to do is to implement notification observers for memory warning, and depending on these callback, act and release some of your memory, dont try to calculate memory yourself, just depend on what iOS tells you, iOS will tell you when you are using a lot of memory

Is there any limit to the capacity of an iPhone's documents folder? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there any limit of file size in the Document of IOS app
I'm trying to save a text file in Documents folder on an iPhone. Is there a capacity limitation on this folder? Or does it just depend on the iPhone's memory capacity?
There is no limit to the size of your sandbox other than the remaining capacity of the device itself.
To manage program memory, iPhone OS uses essentially the same virtual memory system found in Mac OS X.
In iPhone OS, each program still has its own virtual address space, but (unlike
Mac OS X) its usable virtual memory is constrained by the amount of physical memory
available. This is because iPhone OS does not write volatile pages to disk when memory
gets full. Instead, the virtual memory system frees up volatile memory,
as needed, to make sure the running application has the space it needs. It does
this by removing memory pages that are not being used and that contain read-only contents,
such as code pages. Such pages can always be loaded back into memory later if they are needed again.
If memory continues to be constrained, the system may also send notifications to
the running applications, asking them to free up additional memory. All applications
should respond to this notification and do their part to help relieve the memory pressure.
For information on how to handle such notifications in your application, see
“Observing Low-Memory Warnings.”

available RAM iPhone app

how do i increase the available memory (more concrete: the part of the RAM) that can be used by my app?
i am not referring to the space available on the harddisk of an iphone, but to the RAM.
does anyone know if there's a way to use the whole free part of the RAM for my app only?
i have to clear this up a bit, sorry if it was too vague:
i had to think of the java heap size, which can be increased by adding a parameter to the startup command of the java programming.
as i don't know, but at the moment suppose on the iphone something similar happens (every app has just xxMB RAM for execution) this value might be adjustable, so that i can use the whole remaining RAM for my app.
which pretty much is what i need for this special app (non-app-store-publication; file-sizes between 50MB and several 100MB)
How do i increase the available memory?
Short answer: you don't.
Memory is managed by the kernel.
Your application process can't control this.
You can't explicitly control this - this is managed by iOS.
You can't do that. Try reducing your memory usage instead of looking for ways to remove well needed limits.
Store your data instead and read from it when needed.
I don't know for sure if you can configure RAM allocated for your app. I think that is taken care of by the iOS kernel
It's unlikely (read: not going to work) that you will be able to allocate anything more than a few Mb in your application at once.
Not planning on publishing your app to the App Store won't change this. Apple don't officially acknowledge the amount of memory in iOS devices. But its known that devices have between 128Mb and 512Mb of physical RAM.
With the kernel, essential applications (Phone app, etc), background processes, etc, you won't have anything like that available to your application. Careful analysis in instruments would suggest that you'll generally start getting memory warnings when you've allocated around 22Mb of RAM in your application.
A change made in iOS 5 makes the watchdog process much more aggressive with killing applications after you get a memory warning. If you get a memory warning on iOS5 you have to reduce your memory usage or you will get jettisoned by the OS.
If you want to proceed, you will have to figure out how to reduce the amount of memory your datasets require. Its unlikely that all of the 100Mb file needs to be in memory at once. iOS devices have "relatively" fast CPU's and storage, you'll have to architect your application to read and write to storage in chunks and work on smaller subsets of your data.
Some related Stackoverflow questions and links:
Monitor memory usage in an iphone app?
How much memory can an iPhone app use?
10 iPhone Memory Management Tips

What is the maximum sandbox size on iPad?

I'm writing an iPad app that acts as a media player (video and photos). I know there is a 2GB size limit on apps, however is this the size limit on an app when downloaded? Or the limit on the size of your sandbox throughout the life of the app? For example what if my small app later on downloads various media files to its sandbox that put the user over 2GB total (app + downloaded media)?
Thanks!
There is no limit to the size of your sandbox other than the remaining capacity of the device itself.
I did a little test last night, and my sandbox was over 8 GB when I finally called it quits.
Sandbox size is unlimited, According to the iPhone Application Programming guide:
To manage program memory, iPhone OS uses essentially the same virtual memory system found in Mac OS X. In iPhone OS, each program still has its own virtual address space, but (unlike Mac OS X) its usable virtual memory is constrained by the amount of physical memory available. This is because iPhone OS does not write volatile pages to disk when memory gets full. Instead, the virtual memory system frees up volatile memory, as needed, to make sure the running application has the space it needs. It does this by removing memory pages that are not being used and that contain read-only contents, such as code pages. Such pages can always be loaded back into memory later if they are needed again.
If memory continues to be constrained, the system may also send notifications to the running applications, asking them to free up additional memory. All applications should respond to this notification and do their part to help relieve the memory pressure. For information on how to handle such notifications in your application, see “Observing Low-Memory Warnings.”
IIRC, Apple limits size of d/led applications to 20MB.