1

I have a button in my app that switches container views, from a tableview to a Google map view.

The switch works around 4 times, then when I try to switch container views again, the app crashes and I get the following error:

(71189,0xac12f2c0) malloc: *** mmap(size=1492946944) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
2013-06-17 21:37:28.876 Vicinitime[71189:12e03] *** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /SourceCache/UIKit_Sim/UIKit-2380.17/UITableViewRowData.m:400
2013-06-17 21:37:28.876 Vicinitime[71189:12e03] *** Terminating app due to uncaught   exception 'NSInternalInconsistencyException', reason: 'Failed to allocate data stores for 373235904 rows in section 0. Consider using fewer rows'
*** First throw call stack:
(0x258b012 0x23b0e7e 0x258ae78 0x1e46665 0x14d969b 0x14dc224 0x13a0952 0x13a02dc 0x13a3dd6     0x13a8a7e 0x13452dd 0x23c46b0 0x533fc0 0x52833c 0x528150 0x4a60bc 0x4a7227 0x549b50 0x130aedf 0x2553afe 0x2553a3d 0x25317c2 0x2530f44 0x2530e1b 0x30617e3 0x3061668 0x12f4ffc 0x24fd 0x2425)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

Here is the code to switch containers. Sorry about the messy code, but viewcontroller2 is actually a tableview, just named wrongly. det is a BOOL

-(IBAction)changer:(id)sender
{

    if(det == TRUE)
    {
        test *viewController2 = [[test alloc]init];
        viewController2.view.frame = self.container.bounds;

        [viewController2 willMoveToParentViewController:self];
        [self.container addSubview:viewController2.view];
        [self addChildViewController:viewController2];
        [viewController2 didMoveToParentViewController:self];

        [UIView beginAnimations:nil context:nil];

        [UIView setAnimationDuration:1];

        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft  forView:self.container cache:YES];

        [UIView commitAnimations];

        det = FALSE;
    }
    else
    {
        ViewController *viewController1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc1"];
        viewController1.view.frame = self.container.bounds;

        [viewController1 willMoveToParentViewController:self];
        [self.container addSubview:viewController1.view];
        [self addChildViewController:viewController1];
        [viewController1 didMoveToParentViewController:self];
        [UIView beginAnimations:nil context:nil];

        [UIView setAnimationDuration:1];

        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight  forView:self.container cache:YES];

        [UIView commitAnimations];

        det = TRUE;

    }
}

Any idea what is going on?

CRDave
  • 9,279
  • 5
  • 41
  • 59
Spenciefy
  • 892
  • 11
  • 33

0 Answers0