On May 9, 2012, at 12:58 PM, James Maxwell wrote:

> I've been having problems with my app crashing with an EXC_BAD_ACCESS while 
> unarchiving a saved data file. The file is a graph representation of musical 
> structure, created by a machine learning algorithm. When the file/graph is 
> small there are no problems, but as I add more training material, and the 
> file increases in size, at a certain point it starts crashing during 
> unarchiving.

Are you building for OS X or iOS? If the former, then are you building for X86 
or X86-64? If the former, then have you considered transitioning? :)

> This morning, I tried enabling Guard Malloc (on its own, without zombies), 
> and was surprised to see the app crash during training, with the following 
> error:
> 
> GuardMalloc[ManuScore-2438]: Failed to VM allocate 1864016 bytes
> GuardMalloc[ManuScore-2438]: Explicitly trapping into debugger!!!
> 
> 
> Is it simply running out of VM while trying to build the graph?

Yes.

> If so, why doesn't this happen with Guard Malloc off?

Turning Guard Malloc on greatly increases the overall memory usage of the 
process.

> Also, with zombies and guard malloc off, why is it only when reading the file 
> that the app crashes, not during training (i.e., while the graph is being 
> built)? 

You can see for yourself by running your app in Instruments using the object 
allocations instrument. This is just a guess, but what might be happening is 
the reading process is directly or indirectly generating many temporary objects 
that are being pushed into the autorelease/collection pool, which is bulging 
after a while. If you're using RR or ARC memory management, then you can fix 
this by grouping code that generates temporary objects into @autoreleasepool 
blocks. If you're using GC memory management, then you might need to manually 
run the collector more often.

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to