How to port the awesome PhotoScrollerNetwork in MonoTouch? - ios

I'm trying to port the PhotoScrollerNetwork app to MonoTouch (a much improved version of the iOS 5 Apple PhotoScroller example), but the code is doing things that I'm unable to reproduce in MonoTouch.
https://github.com/dhoerl/PhotoScrollerNetwork
For example the memory management is very difficult to reproduce in MonoTouch, and without it it crashes. The author (dhoerl) wrote in the readme:
v2.0:
- iPad1 and iPhone3GS (with only 256M of memory) were getting killed with no OS warning. So, created an upper limit on cdisk cache usage,
and flush files (to free up memory) when the threshold is hit. Crashes
went away.
Porting the following class in MonoTouch is very complicated:
TiledImageBuilder.m
Maybe there is another, simpler way in MonoTouch to handle the above memory management tricks, due to his GC. Has anybody else tried to port the PhotoScrollerNetwork app and wanna share?
Any suggestion is appreciated,
Thanks.

Related

Jetsam kills WebGL application on iOS

I am currently struggling with memory management inside a webgl application on the web, on iOS only.
I keep getting the following error message :
Application 'UIKitApplication:com.apple.Preferences[0xa7c1]' was killed by jetsam.
I understand that Jetsam is the system process responsible for memory management, but the crash occurs while the browser uses around 25% of the device's RAM, which is not that high. I don't have any other open application while running my webGL content. What I don't understand is what Taun Chapman said :
Jetsam monitors memory use and kills applications which are not good memory citizens. A good memory citizen is an application which is willing to give back memory when asked and does not keep asking for more memory.
Well, the app needs more memory in a short time (when unzipping 3D models using workers), I can't continue my app without it! And it crashed at these particular times.
Moreover, I think I have some memory leaks in my app, according to Chrome DevTools I am currently trying to fix. But the browser itself seems to have some leaks too. Thus, fixing mine will just delay the inevitable.
I know the following question is odd, or inappropriate, but do you know if the jetsam "limit" can be increased ? Or if you can add an exception on the currently running WebGL app ?
For your information, I use the Three.js WebGL library and the zip.js library to compress my 3D models.
Yes, I've already read the following question : Why does simple website crash on mobile (iOS Safari and Chrome, at least)?, but the problem does not come from my CSS.
The 10.3.2 version of iOS (released the 15th of May) made Jetsam less aggressive, or at least, the memory is better handled.
https://support.apple.com/en-gb/HT207798

Diagnosing memory leak in Appcelerator titanium iOS iPad app

I am working on an iPad App that is built with Appcelerator Titanium Studio.
The app works great in simulator, but it crashes every now and then in the older models of iPad. So, I decided to see what's happening with the app by letting it run in simulator and using the XCode Instruments to see any leak.
As expected, there appears to be some leaks, this is what I can see in the report:
I have no idea what this thing is reporting back. How do you use this report to find the leak in your app? Has anyone got any experience with this?
memory leaks is all up to your code. There are no specific memory leaks you can just point to. However, there is a pretty good blogpost with some great basic rules you will have to follow to prevent memory leaks.
In case there are any memory leaks in Appcelerator's code, you will need to report it to their JIRA. However, my app for example is pretty big and I haven't encountered any so far. And if there are, they are tiny, as the memory usage is pretty consistent.
http://www.tidev.io/2014/03/27/memory-management/
If you want to locate the memory leak, try "Allocation" instrument.
You can follow this article.

'Termination due to memory pressure" in UIWebView

I have started receiving app termination due to memory pressures very recently (mostly with iOS 7). The app used to work very well on iOS 6.
The app is mostly uses a UIWebView to display a webpage. However for a few webpages it creates ever increasing Dirty memory with most of it due to Image IO and Performance tool data (see attached instruments screenshots). I am completely clueless as to where to dig next. Could someone guide me what should I do here onwards? In the second screenshot I see a sudden bump in the memory allocations. Is there a way to spot the process/part of the code which caused it?
EDIT One can reproduce these results in a simple demo kept at www.github.com/nikhiljjoshi/iosCrash (just change the site to www.nzz.ch).
Thanks in advance,
Nikhil

UIImagePickerController in source type Camera with allowsEditing to YES causes a “Terminated due to memory pressure” in iOS 7? [duplicate]

I am working on an iOS app in Xcode. Earlier I got it to start and run, up to a limited level of functionality. Then there were compilation failures claiming untouched boilerplate generated code had syntax errors. Copying the source code into a new project gets a different problem.
Right now, I can compile and start running, but it states before even the launch image shows up that the application was closed due to memory pressure. The total visual assets is around 272M, which could be optimized some without hurting graphical richness, and is so far the only area of the program expected to be large. (The assets may or may not be kept in memory; for instance every current loading image is populated and my code never accesses any loading image programmatically.) And it crashes before the loading image has itself loaded.
How can I address this memory issue? I may be able to slim down the way images are handled, but I suspect there is another root cause. Or is this excessive memory consumption?
Thanks,
Review the Performance Tuning section of Apple's iOS Programming documentation. Use Apple's Instruments application to determine how, when, and how much memory your app is using.
One approach you should consider is to disconnect the graphics resources from your application, and add them back one-by-one once you feel they meet the requirements and limitations of iOS.
Now, this part of my answer is opinion: it sounds like your app is a high risk for being rejected from the App Store, in case that is your intended destination for this app.

How can I address an app that started earlier, but is "Terminated due to Memory Pressure" now?

I am working on an iOS app in Xcode. Earlier I got it to start and run, up to a limited level of functionality. Then there were compilation failures claiming untouched boilerplate generated code had syntax errors. Copying the source code into a new project gets a different problem.
Right now, I can compile and start running, but it states before even the launch image shows up that the application was closed due to memory pressure. The total visual assets is around 272M, which could be optimized some without hurting graphical richness, and is so far the only area of the program expected to be large. (The assets may or may not be kept in memory; for instance every current loading image is populated and my code never accesses any loading image programmatically.) And it crashes before the loading image has itself loaded.
How can I address this memory issue? I may be able to slim down the way images are handled, but I suspect there is another root cause. Or is this excessive memory consumption?
Thanks,
Review the Performance Tuning section of Apple's iOS Programming documentation. Use Apple's Instruments application to determine how, when, and how much memory your app is using.
One approach you should consider is to disconnect the graphics resources from your application, and add them back one-by-one once you feel they meet the requirements and limitations of iOS.
Now, this part of my answer is opinion: it sounds like your app is a high risk for being rejected from the App Store, in case that is your intended destination for this app.

Resources