Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GuardMalloc results in virtual memory exhausted

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

like image 371
David Potter Avatar asked Dec 22 '12 00:12

David Potter


1 Answers

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

Filing this answer so an answer can be accepted.

like image 84
David Potter Avatar answered Nov 04 '22 12:11

David Potter