Andrew
Andrew

Reputation: 16051

Find out how much memory an iPhone has?

My app takes the NSData of movie objects and sends it over a network. The problem is, if the video is large enough, I'm worried my app will crash because of having so much data in memory. Is there a way to check the limits of the iPhone being used, so I can stop it transferring videos larger than that?

Upvotes: 0

Views: 306

Answers (3)

Xcoder
Xcoder

Reputation: 1807

I dont think its right define a limit on the basis of memory available in the device. I would suggest you to upload file from disk. ASIHTTP has provision to stream file from disk. This will solve your memory problem.

Upvotes: 1

borrrden
borrrden

Reputation: 33421

Your application will receive a memory warning when it is using too much memory. That is your only way of knowing. A view controller will get its didReceiveMemoryWarning method called. A UIApplicationDidReceiveMemoryWarningNotification event will also be raised.

Upvotes: 2

zoul
zoul

Reputation: 104065

Even if you find out the amount of memory available on the current device, the system will start killing apps long before you allocate even a half of that amount. Can’t you simply choose a sensible safe block size and send the video in chunks?

Upvotes: 0

Related Questions