0

I am getting this error causing my app to crash:

..Splash-it(1369,0x5783000) malloc: *** mmap(size=516096) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

I have no idea why the error is caused. Is it a memory problem error? How can I prevent it? What do they mean by "set a breakpoint in malloc_error_break to debug"?

Thanks for any answers.

Alessandro
  • 4,000
  • 12
  • 63
  • 131

3 Answers3

1

In my case i was getting this because imgCount is not getting value as my condition fails. And the non void function is returning the value of imgCount.

- (NSInteger)collectionView:(PSUICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    NSInteger imgCount;
    if(collectionView == self.imageCollection) {
        imgCount=self.imageCount;
    }
    return imgCount;
}

So i resolved it by assigning the value to imgcount. It works for me.

sunkehappy
  • 8,970
  • 5
  • 44
  • 65
Arun
  • 483
  • 6
  • 20
  • This answer helped me by realizing i was just referencing a array for the count instead of array.count , thank you!!! – ChuckKelly May 01 '16 at 08:52
1

Chances are that you are trying to allocate too much memory at once. I tried to malloc crazy big amounts of memory, and I got this error.

nobody
  • 1,144
  • 1
  • 10
  • 20
0

Not sure but this is waht happened in my case & I resolved by removing breakpoint.

I was loading data from server & adding them to tableview & hiding or showing footer. At times my footer view was not appearing as I wanted so I inserted the breakpoints to check out whats going wrong. But then after some time doing the same activity my app got above error.

I tried this 2-3 times without breakpoint & it did not crash but, whenever I added breakpoint the error occured.

This may not be in your case but I guess if you are doing some large operations on main thread & if you have inserted breakpoints, you can atleast try this once.

JiteshW
  • 2,195
  • 4
  • 32
  • 61