Discussion Forums  >  Crashes, Memory Warnings

Replies: 34    Views: 337

Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
03/31/13 09:47 AM (11 years ago)

ios 6.1 crash ?memory issue

Hi guys, I would really appreciate some advice on problems I have run into with my app. I am using buzztouch 2.0 (not self hosted) and getting random crashes. Everything seems okay on the ios simulator, but after prolonged use, say only 10minutes, on an iphone my app crashes. Other friends beta testing on testflight have also run into the same issue. The log report is: 2013-03-31 17:03:54.585 myappname[6948:907] BT_viewUtilities: getProgressView 1 0x38fa51c9 <redacted> 2 0x38f33e51 <redacted> 3 0x38f30d7d <redacted> 4 0x38fdbc3f <redacted> 5 0x38fdb8d7 <redacted> 6 0x38fdb577 <redacted> 7 0x38fb080d <redacted> 8 0x38facf0f <redacted> 9 0x38f2ac51 <redacted> 10 0x38f9e5d7 <redacted> 11 0x38fdaa93 <redacted> 12 0x38f4907f <redacted> 13 0x38f2a629 <redacted> 14 0x38f2a45f <redacted> myappname(6948,0x3cc8eb88) malloc: *** mmap(size=32768) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug 15 0x38f2a293 <redacted> 16 0x38f23497 <redacted> 17 0x38f9c3fd <redacted> 18 0x38f7fa37 <redacted> 19 0x38f796b1 WebCore::DocumentLoader::commitData(char const*, unsigned long) I'm guessing its a memory issue from searching google but I am a complete loss on how to fix it. Any help or advice would be very much appreciated. Many many thanks for any help in advance.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
03/31/13 04:15 PM (11 years ago)
UPDATE: I have had a go with instruments and found some potential memory leaks (see image below). As a newbie I feel a bit stuck now. There don't seem to be any threads on malloc errors with buzztouch on the forums here.... http://s11.postimg.org/kqt3rb45f/Screen_Shot_2013_04_01_at_00_02_12.png Many thanks for any help or advice guys as I am really worried I am in over my head with this.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/31/13 07:20 PM (11 years ago)
I would look into your code and ensure that you release all the objects in your 'dealloc' method. In each 'module' there is a dealloc method; take a look at the other plugins and stuff, and see how they're managing theirs. Yours should be similar. I couldn't interpret those hex codes if my life depended on it, lol! Cheers! -- Smug
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/01/13 02:37 AM (11 years ago)
Thanks for the advice smug! Unfortunately I'm not a programmer but happy to fiddle with code if there are any walkthroughs. I have had look through the forums but can't find any posts with related problems. Could you point me the rough direction? Many thanks again!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/01/13 02:57 AM (11 years ago)
In each plugin, there is a 'dealloc' method. Looks sorta like this: //dealloc -(void)dealloc { [super dealloc]; } But all it's releasing is the part of memory from the 'view' that buzztouch created. Everything else inside a plugin is something that 'we' created. All the variables we call, all the windows we draw, all that stuff... So, as we when the screen is closed, you want to deallocate that memory for something else (or nothing else, it's always good practice to catch and release). So for all the variables in your header file, release them, (in the .h file) NSString *myString; UIView *myView; NSSomeVariable *myVar; ... (in the .m file) <-- Sorry I didn't add this earlier! //dealloc -(void)dealloc { [super dealloc]; [myString release]; [myView release]; [myVar release]; } sorta like that... I'm not sure if it's going to help. But it certainly can't hurt. Cheers! -- Smug
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/01/13 04:23 AM (11 years ago)
Thanks smug... I think you maybe on the right track. Its definitely a memory issue. My app is a series of html doc screens interlinked with menus. Given that the crash tends to happen after going though a few html doc screens I thought that this would be the plugin I look at first. Please excuse me for asking these very very basic questions (most other forums I would be expected to flamed badly) but I have added the following to the end of the plugin at the BT_screen_htmlDoc.h file: //dealloc -(void)dealloc { [super dealloc]; [externalURL release]; [localFileName release]; [saveAsFileName release]; [dataURL release]; [webView release]; } However doing this gives another error (expected ";" after method prototype), so I am obviously doing something wrong. Any more pointers? Again thank you so much for your help thus far; I really hope I don't have to start the app from scratch!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/01/13 05:53 AM (11 years ago)
I'm sorry; It looks like I could have been slightly erroneous; Objects get released. Variables are set to nil. That's what I get for trying to think instead of looking things up, lol! My bad! //dealloc -(void)dealloc { [super dealloc]; [myString = nil]; [myView release]; [myVar = nil]; } Cheers! -- Smug
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/01/13 06:18 AM (11 years ago)
Oh I see. I have added (just before @end) in BT_screen_htmlDoc.h: //dealloc -(void)dealloc { [super dealloc]; [externalURL = nil]; [localFileName = nil]; [saveAsFileName =nil]; [dataURL = nil]; [webView = release]; } Unfortunately I then get: "Expected ";" after method prototype error" in xcode, (see the screenshot below) http://postimg.org/image/u64sgxzjf/ Any ideas??? Thanks loads for your help thus far Smug!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/01/13 06:25 AM (11 years ago)
That looks like that is your header file. That doesn't go in the header file; it goes in the implementation (*.m) file. I see what happened; I didn't separate them in my example. Again, my bad. Sheesh. The header file example was just showing you the 'sample' objects and variables that you'll need to release. But you release them in your implementation file... There will already be a dealloc method there; you just need to add your stuff to it. Sorry to have confused you. Cheers! -- Smug
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/01/13 07:05 AM (11 years ago)
Thanks smug- that does make more sense. I have looked at all the dealloc... all the samples and variables are already there in each plugin. Looks like I am back at square one :-( Its definitely a memory leak issue. I just don't know/lack the expertise to find it. The basic setup for the app is: 1 menu with image linked to 3 menu buttons linked to 68 simple menus linked to 99 HTML doc Also includes: 1 splash screen 1 notepad feature 1 app rater 1 timer Its an educational app for doctors, hence the high number of screens (!). Anymore suggestions? Thanks again Smug!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/01/13 08:35 AM (11 years ago)
Make sure all objects assigned to memory via alloc/init are released. Do a search for "alloc" to find all such objects. Will be tedious though.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/01/13 10:01 AM (11 years ago)
Thanks for the advice Chris. I've done a search and all the entries assigned via alloc are in dealloc. Is there away I can find where the exact culprit is from debug/instruments? Thanks again for your input thus far guys- Buzztouch is a great place.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/13/13 12:54 PM (11 years ago)
Hi all, Eventually fixed the malloc error. Thanks for all the advice guys, used your wise words and Mr google. In case anyone has anything similar, my rough fix was: - Ran analyser and idenitified lots of potential memory leaks - Ran instruments to find the particular memory leak whilst using the app on my phone - From the leaks found you can link straight into xcode - my error was [[NSMutableArray alloc] init] and I changed this [[[NSMutableArray alloc] init] autorelease] - I then ran analyser to make sure it had gone - Retested the app the error was gone from the debug too! Hope this is useful to someone
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/13/13 08:59 PM (11 years ago)
Glad you fixed it! Was this in a standard plugin? If so, would you mind sharing so we know what we should change on our apps? (and maybe so the developer can update the plugin)
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
04/14/13 04:19 AM (11 years ago)
Hi Chris. I found the error in BT_Screen_menuListSimple.m and made the change to: //init the items array self.menuItems = [[[NSMutableArray alloc] init] autorelease]; I'm guess its very app dependent and possibly may be a source of memory leaks some. In my case it was. Fais
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/14/13 05:02 AM (11 years ago)
Interesting - I'm surprised that's not released in the dealloc method at the bottom. I'll have to take a look at it later when I'm in front of my computer
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/06/13 11:36 AM (10 years ago)
@chris1 seems I talked too soon; I am still getting the errors. But admittedly I have to work the app very hard to get it. After approx. 96 html doc views the app crashes (ie moving backwards and forwards between menu button to a html doc screen). It always seems at about the 96 screen point give or take. I followed chris1's great tutorial on nailing erors and created the breakpoints. Here is the screen shot: http://img40.imageshack.us/img40/9595/screenshot20130506at193.png Interestingly however (and I have tested this on two different ios devices) buzztouch apps with html doc plugins all seem to have a similar problem. I have tested gilbert district app and key2gib app (both mentioned on these forums), and both do the same this after multiple accesses to html pages. Any ideas guys? Thanks again, these forums have been a godsend to novices like me!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/06/13 11:58 AM (10 years ago)
A couple of things ... In your screenshot, you'll notice on the thread listing at the left that you're not on a process from a plugin. Click on one of the menuButton processes and see what they show. One should be a [self showIt:...] method that's causing issues. Probably not passing a string variable or something. Also, remember that phones are just mini computers, and will crash from time to time. Try loading 96 webpages in rapid succession on your mobile safari app - I bet you get it to crash too. I know it's crashed on me before several times. The HTML doc plugin is really just a scaled down version of Mobile Safari - nothing in it should cause a crash on its own.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/06/13 12:25 PM (10 years ago)
Thanks for the superfast reply Chris! I think this should be the correct screenshot: http://img571.imageshack.us/img571/9595/screenshot20130506at193.png Any ideas on how I could fix it? I have gone through several builds of the app and changed everything from using simple menus to buttons, validated all my html screens and changed the pngs. The strange thing about the crashes I don't have to be rapid in the using my app (or the others listed for that matter); I could leave it for a few hours. Ultimately however, I doubt any of my users would use the app in one stretch long enough to replicate the problem. I think I am probably being too pedantic... Thanks again!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/06/13 01:46 PM (10 years ago)
not sure about that error. It really shouldn't be causing an issue, but obviously it is. Try commenting it out by putting 2 slash marks in front of it, like so: //[BT-debugger...
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/06/13 02:56 PM (10 years ago)
Thanks for the advice Chris... Unfortunately the app still crashes. However the threads are now slightly different. Its now pointing to something in the BT_navigationController: http://img543.imageshack.us/img543/4246/screenshot20130506at225.png Could I comment this out too? I really do appreciate the advice you have given thus far!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/06/13 03:17 PM (10 years ago)
Nope - again though, click on the process for menuButton screen.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/06/13 03:18 PM (10 years ago)
Also, would be helpful to see more of the debug info
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/11/13 05:10 AM (10 years ago)
Sorry for the late reply Chris- busy week at work and had no chance to get back to the app! Done the debug but getting completely different error now: 2013-05-11 12:57:41.874 CSAAPP2013[159:907] BT_screen_htmlDoc: url to load: <a href="file:///var/mobile/Applications/EA725E63-8B96-47B4-B550-111528A17C7E/CSAAPP2013.app/Case%204%20Doctor.html" target="_blank" rel="nofollow">file:///var/mobile/Applications/EA725E63-8B96-47B4-B550-111528A17C7E/CSAAPP2013.app/Case%204%20Doctor.html</a> 2013-05-11 12:57:41.889 CSAAPP2013[159:907] BT_screen_htmlDoc: url scheme: file 2013-05-11 12:57:41.904 CSAAPP2013[159:907] BT_screen_htmlDoc: webViewDidStartLoad 2013-05-11 12:57:41.910 CSAAPP2013[159:907] BT_screen_htmlDoc: showProgress 2013-05-11 12:57:41.914 CSAAPP2013[159:907] BT_viewUtilities: getProgressView 1 0x3625f959 <redacted> 2 0x3625f861 JSC::MarkedAllocator::allocateSlowCase() 3 0x36105c07 <redacted> 4 0x382665b7 <redacted> 5 0x382662ff <redacted> 6 0x38266145 <redacted> 7 0x382660b9 <redacted> 8 0x38265fb3 <redacted> 9 0x38265ec9 WebCore::ScriptController::initScript(WebCore::DOMWrapperWorld*) 10 0x384142e3 <redacted> 11 0x384141a7 <redacted> 12 0x34365349 <redacted> 13 0x342cf399 <redacted> 14 0x342dbbbf <redacted> 15 0x322689c4 <redacted> 16 0x321bffeb <redacted> 17 0x321bfb43 <redacted> 18 0x38ac8653 <redacted> 19 0x3226761b <redacted> 20 0x321bef68 _CF_forwarding_prep_0 21 0x322689c4 <redacted> 22 0x321bffeb <redacted> 23 0x381f3cf3 <redacted> 24 0x38230d0d <redacted> 25 0x3223a683 <redacted> 26 0x32239ee9 <redacted> 27 0x32238cb7 <redacted> 28 0x321abebd CFRunLoopRunSpecific 29 0x321abd49 CFRunLoopRunInMode 30 0x35d5e2eb GSEventRunModal 31 0x340c1301 UIApplicationMain Screen shot from xcode (re-uploaded, sorry): http://img571.imageshack.us/img571/4325/screenshot20130511at130.png Any ideas guys??? Thank you so much in advance!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 06:02 AM (10 years ago)
Says photo has been removed?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 06:06 AM (10 years ago)
Would seem you're having an issue with the HTML file not being able to load. Just to see, what happens if you rename the file without using spaces? (Noticed there's a couple of %20's in the name, which represent a space.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/11/13 07:01 AM (10 years ago)
Sorry Chris- re-uploaded the screenshot: http://img571.imageshack.us/img571/4325/screenshot20130511at130.png Will retry changing the html files too and will let you know what happens; fingers-crossed your right! Cheers mate!
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/11/13 04:05 PM (10 years ago)
I've made the changes to the html files but no cigar. Here is the latest debug: 2013-05-11 23:51:02.512 CSAAPP2013[391:907] BT_screen_htmlDoc: Loading file from Xcode bundle: Case6Patient.html 2013-05-11 23:51:02.518 CSAAPP2013[391:907] CSAAPP2013_appDelegate: supportedInterfaceOrientationsForWindow 2013-05-11 23:51:02.520 CSAAPP2013[391:907] BT_screen_htmlDoc: canBecomeFirstResponder in BT_viewController BASE CLASS 2013-05-11 23:51:02.587 CSAAPP2013[391:907] BT_screen_htmlDoc: shouldStartLoadWithRequest 2013-05-11 23:51:02.590 CSAAPP2013[391:907] BT_screen_htmlDoc: url to load: <a href="file:///var/mobile/Applications/EA725E63-8B96-47B4-B550-111528A17C7E/CSAAPP2013.app/Case6Patient.html" target="_blank" rel="nofollow">file:///var/mobile/Applications/EA725E63-8B96-47B4-B550-111528A17C7E/CSAAPP2013.app/Case6Patient.html</a> 2013-05-11 23:51:02.591 CSAAPP2013[391:907] BT_screen_htmlDoc: url scheme: file 2013-05-11 23:51:02.594 CSAAPP2013[391:907] BT_screen_htmlDoc: webViewDidStartLoad 2013-05-11 23:51:02.595 CSAAPP2013[391:907] BT_screen_htmlDoc: showProgress 2013-05-11 23:51:02.598 CSAAPP2013[391:907] BT_viewUtilities: getProgressView 1 0x361fb051 <redacted> 2 0x3610767d <redacted> 3 0x382665b7 <redacted> 4 0x382662ff <redacted> 5 0x38266145 <redacted> 6 0x382660b9 <redacted> 7 0x38265fb3 <redacted> 8 0x38265ec9 WebCore::ScriptController::initScript(WebCore::DOMWrapperWorld*) 9 0x384142e3 <redacted> 10 0x384141a7 <redacted> 11 0x34365349 <redacted> 12 0x342cf399 <redacted> 13 0x342dbbbf <redacted> 14 0x322689c4 <redacted> 15 0x321bffeb <redacted> 16 0x321bfb43 <redacted> 17 0x38ac8653 <redacted> 18 0x3226761b <redacted> 19 0x321bef68 _CF_forwarding_prep_0 20 0x322689c4 <redacted> 21 0x321bffeb <redacted> 22 0x381f3cf3 <redacted> 23 0x38230d0d <redacted> 24 0x3223a683 <redacted> 25 0x32239ee9 <redacted> 26 0x32238cb7 <redacted> 27 0x321abebd CFRunLoopRunSpecific 28 0x321abd49 CFRunLoopRunInMode 29 0x35d5e2eb GSEventRunModal 30 0x340c1301 UIApplicationMain 31 0x7db81 main (lldb) Screenshots: http://img811.imageshack.us/img811/4770/screenshot20130511at235.png http://img812.imageshack.us/img812/1337/screenshot20130512at000.png This all looks very puzzling to me! What do you think Chris, Smug or even David (sorry to drag you in)??? Thanks again Fais
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/11/13 04:22 PM (10 years ago)
I'm kind of thinking that Chris is right; it 'looks' like you're having an issue with one of your HTML plugins for some reason, but I've never been able to work out Apples debugger, until Chris1 wrote this great tutorial... https://www.buzztouch.com/files/howtos/exception%20debugging%20how-to.pdf Try using it to isolate the area that you're having an issue with; he's made it rather easy to find. Let us know what comes up! Cheers! -- Smug
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 04:25 PM (10 years ago)
Can u post the HTML file or email it to me? I wonder if it will load in my app? Looks like something in JavaScript is crashing it?
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/11/13 05:05 PM (10 years ago)
@smug Thanks for the link- Chris did a great job with tutorial. The debug and screenshots above are actually the results of following it :) @Chris to be honest I'm not sure which HTML file it is causing the crash. There are 36 html files at present (cut down in a rebuild). The crash happens randomly after reading through several them. The HTML files validate fine and I have not written any Java for them (my coding skills only go as basic HTML).I'm happy to send my sourcefiles if that's easier!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/12/13 07:44 PM (10 years ago)
Well it looks like this crash was from Case6Patient.html. But if it occurs sporadically then it might be a pure memory issue. Do you have lots of images in the files? Unfortunately I'm on the road this week, so I won't be able to look at it for several days.
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/15/13 02:10 AM (10 years ago)
Yep the crash is sporadic, it can happen on any page. The html files have no images, just text. The only images in the app are the buttons (about 10kb each), splash, header for the main page and icon buttons. So I'm a bit at a lost where the error is- this is the 4th build of the app and its the same issue with malloc. I can recreate the same problem as I mentioned in other apps that are created with buzztouch. Am I being too pedantic? I can't crash mobile safari in the same way I have been able with the apps. Anyway I really do appreciate the help and input guys, please keep it coming ;-)
 
Lester
buzztouch Evangelist
Profile
Posts: 17
Reg: Aug 12, 2011
Florida
10,670
like
05/27/13 08:23 PM (10 years ago)
I'm having the exact same issue as @Fais on all my apps. They are mostly menu lists and html docs also. After applying the fix @Fais suggested (self.menuItems = [[[NSMutableArray alloc] init] autorelease];) a crash happens after loading ~90 screens instead of ~30. I don't have a fix, but following this thread!
 
Fais
I hate code!
Profile
Posts: 38
Reg: Jan 19, 2013
Bristol
2,030
like
05/28/13 12:51 AM (10 years ago)
Hi Lester, I'm afraid I didn't get much further than the above posts. If possible could you post your debug and screenshots? if its a similar issue we maybe able to brainstorm a solution together!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.