To render a PDF in Objective C we are calling CGContextDrawPDFPage method. In IOS6, interactive PDFs rendering using this method take large amounts of memory and it leads to memory warning after some time. This is because of the caching mechanism of moved pages inside the application. But the application is crashing due to memory warning. When I profile the application in IOS6 the memory is working perfectly in IOS5 and memory is stable. Anybody know about this issue? Are there any changes in PDF rendering(CoreGraphics & QuartzCore) frameworks in IOS6?
Related
We have an app built on the iOS 10 SDK. It is presenting images in a UICollectionView and the images are loaded using the SDWebImage framework. It works well, but users have reported that the app suddenly crashes from time to time when scrolling back and forward through the images in the UICollectionView.
We have at last been able to reproduce the error on an iPhone 6 device with the mobile data connection slowed down to 3G.
What happens:
While scrolling quickly up and down through the images, quicker than they can be loaded from the server, suddenly the app crashes back to the iOS desktop. This could happen quickly, after a while, or sometimes it does not happen at all - very inconsistent.
What we have done so far:
Used instruments to check for leaks, the memory consumption is stable and lies constantly around 200Mb.
There are no calls to didReceiveMemoryWarning
We use CrashLytics to detect crashes and exceptions, nothing is logged.
The console or the debugger does not indicate any errors and no exceptions, Xcode just reports that it lost the connection to the phone when the app crashes.
Could anyone suggest an approach for further troubleshooting to nail this?
Stefan
I had a similar issue with SDWebImage. For me, it was because I let SDWebImage keep loading too many images at once. After adding
- (void)prepareForReuse
{
[self.imageView sd_cancelCurrentImageLoad];
}
the issue disappeared.
I am building an app that has several UIWebviews all displaying various content. While testing my app, I ran into an error that said the app was terminated due to memory pressure, and I checked the console, and sure enough I had received a memory warning. Upon further testing, I noticed that this only occurs when visiting a specific page. I noticed that this page contains 2 very large image file (both 5,184px × 3,456px), which is different from the other webpages (there are about 100 and this only happens on this one page), so I think that's where the bug is. Is there a way to get UIWebview to process this and present the page, or is there no hope?
This page also puts this image into a UIImageView of size 320x320, but I don't think this is the problem because the image shows up when I go to the page, but the app crashes when I scroll down the UIWebView
I am currently working on an ios7 project that uses uiwebview. There seems to be large memory usage occurring with the use of uiwebivews, mainly we open a new view with a webview for reading mobile html news articles.
We are trying to improve the memory management as it seems that the app hits the "closed due to memory pressure"
I have implemented the memory leak prevention outlined here: http://www.codercowboy.com/code-uiwebview-memory-leak-prevention/
My question though is there a difference in memory usage when using the scrollview to scroll down the content versus just having the uiwebview's frame be the size of the content for a view?
We are currently not using the scrollview and just showing the entire page.
Embedding a UIWebView inside a UIScrollView shouldn't make any memory usage differences at all. Are you sure this is a webview issue? Have you tried making a simple app only containing a webview and pointing it at your page and seeing what happens? You may be leaking/wasting memory elsewhere in your app that needs to be cleaned up.
We came across this issue while investigating low memory crashes on iOS Mobile Safari.
Most noticeably on a large HTML5 application, like a HTML5 game, we've found a memory leak on the browser where memory will keep adding up on every refresh.
In our case, the app runs with about 300MB of real memory usage and it added up around 100MB on every refresh.
Most noticeably on iPad mini and iPad4, it would crash Mobile Safari immediately after a couple of refreshes.
After a long and painful endeavour, we've found the issue being caused by a memory leak on webkit.
It happens when you use a matchMedia listener and you don't de-register the event listener before unload.
To fix it, either do not use matchMedia at all, or be sure to de-register the matchMedia event listener onunload of the page.
We've found the issue was already reported at https://code.google.com/p/chromium/issues/detail?id=113983
i am migrating my iOS app onto mac. the loading time is a bit long (around 5 seconds) thus i need a splash loading screen (Just like Default.png image for iOS) but the project made from cocos2d template just shows a white screen. not sure about other apps. so is there anyway to set it?
I know that the screen size is not fixed on a mac app. but i have set a default size. and use auto scale in case of full screen mode.
EDIT:
I have tried a light weight loading scene as well but failed since the MainScene itself is light weight as well. I think the major loading time is due to the cocos2d environment set up.
In OS X a window appears when the application launches, it's not designed to use splash screens.You might want to reconsider that choice.
But if the window is still to slow to load or to display its contents, you can still do that but manually, it isn't easy like in iOS.You need to display another view inside the window until it loads.
EDIT
A little more of context: for example you can set in your xib file an image view containing the image do display.
Then you make start another thread that loads all the content that you need.After this, run a selector on the main thread that updates the window.
Based on my tests in Cocos2d 1.0.1 & 2.0 the basic Cocos2d OS X app launches really quickly.
This makes it seem pretty likely that it's something about your first scene that is taking a long time to load, or something else. Instruments can help you gather information about what your app is doing.
I suggest you make an initial lightweight cocos2d scene that will load quickly at startup and then load your second scene and transition to it. Ideally the loading of the assets for your second scene would be asynchronous (at least the ones that are slow). There are numerous blog posts on how to do this. (search for "cocos2d asynchronous loading" and you'll find many, such as this one: How to preload your game assets in a loading scene, though something more recent might be preferable).