9
votes

Our app is experiencing occasional crashes in the field (discovered via BugSense) due to what looks like out of memory or memory corruption conditions, so to help me track them down I enabled the following:

  • Malloc Scribble
  • Malloc Guard Edges
  • Guard Malloc
  • Objective-C Zombie Objects
  • Malloc Stack Logging
  • Log Exceptions.

After interacting with the app for a bit in the Simulator (less than 30 seconds), the following message is displayed:

GuardMalloc[TrafficDemoEmp-2430]: allocate_pages(): virtual memory exhaused!
GuardMalloc[TrafficDemoEmp-2430]: expandUniquingTable(): VMCopyFailed
GuardMalloc[TrafficDemoEmp-2430]: allocate_pages(): virtual memory exhaused!
GuardMalloc[TrafficDemoEmp-2430]: expandUniquingTable(): VMCopyFailed

With Guard Malloc disabled the app works fine but with it enabled the app crashes with these messages. When I profile with the Leaks and Allocations instruments no leaks are found and the Live Bytes value for all memory ranges between 30 MB and 80 MB (depending on what it's doing at the time). Surely that's not too much memory for an app.

However, the messages point to my app using too much memory but I'm not sure what is leading to the virtual memory exhaustion. Are there other tools or debugger settings that are available in Xcode to help?

Thanks,
David

1
NSZombies will cause anything you free to not actually be freed, and thus exhaust memory if you're doing lots of allocations. - user1118321
Disabling zombies solve this problem. Thanks. - David Potter
Hi, same problem was there and fixed with disabling zombie..Thanks. But I m not getting how its affect, can you explain me please ? - Nikunj
@OKNC2 Because nothing is actually deallocated, it's inevitable that memory will be deallocated. - David Potter
@DavidPotter Okay, Thanks for the reply. - Nikunj

1 Answers

9
votes

User1118321 was right. NSZombies was the cause of this problem.

Filing this answer so an answer can be accepted.