HTTPNetStreamInfo::_readStreamClientCallBack(__CFReadStream*, unsigned long) increases memory allocation - ios

I am trying to download large video file with httpClient post method. I am working Xamarin.iOS, but it seems to be issue of iOS (NSURLConnection/session) as the Xamarin codes convert it into native one.
My device is having IOS8.1. A memory is kept increasing when I try to download that video file up to 300MB. It goes down when its getting completed (if it gets completed before crashing). It crashes most of the time. I am attaching screenshots for the reference.
I found many people having this issue, but no one have the solution, like this link. Did somebody get a chance to fix this issue?
Please let me know if you need more input to understand the issue

Strange but yes, it is fixed in iOS8.3. NSURLCache was broken in iOS 8.x till iOS8.3. So it was not able to clear the cache. But as I have updated it to iOS8.3, it came down to 32KB block and consumes max 5-7MB.

Related

Why does my Unity ios app's Documents and Data keep increasing?

I created my first app back in July. It came out to be 55mb. I have recently noticed that the Documents and Data section for my app is 150mb, nearly 3 times the app size. Doing more tests I have realized that each time I play the game it increases by 1mb. It is now at 170mb.
I am using Unity 5.6.1p4 and Google Admob.
My app does not download any update files to run the game so that isn't the issue.
I have a couple of guesses but none seem very likely:
1) My game is only about half as optimized as it should be. I still use a lot of instantiate and destroy. An other post said that the memory issue is due to Apple's inability to garbage collect. That is a possibility but I cannot understand why the data from instantiate/destroy would be cached. I also find it hard to believe no one else has had that issue.
2) When the game first starts, it automatically loads a banner ad and a video ad so that there is no delay when the user first requests a reward video. Some people have said that Google Admob caches ads so there is less data usage. That seems like it would cause some increase in file size but 170mb is too much data to be cached. Again I find it hard to believe no one would have complained to Google about this before.
Any help would be greatly appreciated. I cannot figure out what would be causing it. If you are interested in seeing the problem first hand, the App Store link is https://appsto.re/us/nco9gb.i
Ok, here is my findings: This is either an issue for older phones, or iOS 10.x.
However, I do not know which. I am able to test iOS 10 on older phones (5, 5s and ipad 1). I am not able to find any newer device still running iOS 10. This memory glitch does not seem to happen on iOS 11. I was able to test it on 3x iphone 6s, 2x iphone 7 all running iOS 11.It is not as clear as I would like it to be but iOS 11 does not appear to have the memory issue. As much as I would like to find the cause and fix it, I think the majority of people should be safe because they update.

Ionic barcodescanner App clear memory usage

I'm using barcode scanner on iOS made with ionic. During debug I observe that memory usage keep growing (I saw it on xcode) when the app open the camera to make a scan and after 5 utilisations (5 scans) the app crash with this message : Message from debugger: Terminated due to memory issue.
I've made a lot of searches with nothing satisfying. Can someone know how to avoid the memory increasing or clear it before opening the scanner again ?
Im testing on iPhone 5 / iOS 10.
For those who might encounter this problem I solved it by using a fork of this plugin here https://github.com/jlowe234/phonegap-plugin-barcodescanner.
I include here what was found as the cause of this issue (taken from here : https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/312)
Hello guys, I investigated for this issue and i found the problem on the c++ class. A lot of objects are still in the memory also when barcode viewcontroller is closed (to see the picture below).
So we must delete those files because every time that we open the barcode viewcontroller it takes from 20 to 30 mb so it's a big problem.
I tried to investigate on the C++ code but i don't understand everything so i need of help.
I tested the fork and it's working fine for me. My app stopped crashing and the memory stopped increasing without reason.

iOS app terminated due to memory pressure

I am trying to use image files with my app. These image files are compressed in a .zip-file which is opened from the user from the Mail App or Safari. The .zip-file (which contains the image files) is then unzipped by "SSZipArchive". This works without any problem for smaller files (e.g. 5 images, 10KB). But for bigger files (1900 images, 20MB) the app crashes and it is hard to figure out why because it only crashes when the app is not debugging and not watched by Instruments. A few times I got a crash while using the debugger but only when I opened the .zip-Archive from the Mail App. I then got the message "App terminated due to memory pressure".
Please help!
You're probably testing on the Simulator. That's never reliable, because your computer has lots of memory! Test on the device to find out under real-life conditions whether your app uses too much memory. If it does, you'll get a warning and then (if you don't do something about the problem) a deliberate termination.
The root of your problem is that you simply cannot allocate that much memory under iOS or your app/device will crash. A good rule of thumb is that you app might take 10 to 20 megs of memory while running normally, but if it jumps up to 40-80 at any point then you will be in danger of a crash. You should read up on how much memory images use when decompressed under iOS mem blog post and rework your code to make sure things stay in the 10 to 20 meg of memory usage range.

ridiculously high storage usage in iPhone 6+

I'm working (helping out) on an iOS app. On most devices the app's stabilized storage use is within 60-80MB. The same app (and same revision) on the iPhone 6+ starts using Gigabytes of data within minutes ... to the point of filling up the storage and I can't even run the app from XCode anymore. I've only been able to get it on the iPhone 6 once, but it's a regular occurrence on the 6+. I've also tried on a range of other devices from 5th gen iPod touch to the iPhone 5 and no other device goes over the 80MB.
The only portion of code that uses a significant amount of storage is the image caching, which caches the (static) images downloaded from the server keyed on the image id. Then again this code is (or seems to be) working fine on other devices. It is also a portion of the codebase that hasn't changed in a while.
Can anyone think of a reason why this issue is only seen on the iPhone6+ (and to a much lower extent the iPhone6)?
This isn't a solution, since it's impossible to know what's happening, but you should look at the following:
Is this reproducible on the simulator? (file system is easier to view)
Does the storage get freed when the app is deleted?
Can you see the data in the device organiser in xcode (they keep moving it, but somewhere you can plug in the device, see the app, and then see the file sandbox for that app)
What data is it? This should give you a clue as to its origin
is there a set of actions in the app that kick off the problem?
If this works, you should get a clue as to the offending code. Then, update your question, unless the solution is obvious!
The problem was that malloc stack logging was enabled and not set to compact. It logged every single allocation made by the app and it was the log file that grew so large.
As to why it only occured on the iPhone6 and iPhone6+, I still don't have an answer.
The problematic file was stack-logs.773.1006c8000.REDACTED.wmQj2k.index. It grew to 700MB almost right after login.
Much thanks to #jrturton because his answer really lead to this.

blackberry phonegap app closing after giving an error of being out of memory

I am building a phonegap app for blackberry smartphones. im using phonegap version 1.3.0
in my app, after my first page loads, on a bit of scrolling and exploring, i get a dialog asking me to close the open apps as memory is too low and the only app open is mine. On ignoring that after a minute another dialog comes saying sorry! the memory is too low so closing this app.
also sometimes i get an error saying that the page is too large to load and the page (and the app) is closed.
my app consists of 6-7 pages and only a couple of pages are big and have many images (about 25). can the images be causing a problem? in any case the data downloaded and used does not exceed 5MB.
Can anyone tell me what to do in order to remedy this?
Seems to be a known issue with webworks and certain models of Blackberry phones - See the following thread for a discussion on this specific problem. This is an issue with Some suggestions are to move to Webworks 2.2 but even this does not fix it. (We are facing the same issues as well and hopefully BB fixes it soon).

Resources