On Thu, 22 Sep 2011 21:04:10 -0700, Don Quixote de la Mancha said: >That just has to be a bug. Exceeding the available memory of the >garbage collector should not crash, instead your allocations should >fail. > > Failing allocations should be handled by some kind of error recovery >code. Unfortunately Objective-C provides the "convenience" that it's >Totally Cool to send a message to nil. The problem is that the >message you sent to an object whose allocation failed might have been >a message that really, really needed to be received. Having random >object instantiations failing while continuing to run your app while >messaging nil hither and yon makes for a really flaky app. > >It might not be a bug in your code though. Perhaps you've found a bug >in OS X' allocator. If that's the case and you can prove it, file a >report at http://bugreport.apple.com/ > >Try testing your app with GuardMalloc and the other memory tests. > >Add assert calls at all of the entry points of functions or methods >that expect valid pointers. If such code gets a pointer and does not >explicitly test whether it is nil, then add an assert. Any functions >or methods that return pointers that must be valid should have asserts >added just before their return statement.
Thanks for all your comments Don Quixote. >The valgrind memory debugger now works on Mac OS X, but it is a new >port so it may not be up to the quality that you need for debugging >your code. Give it a try anyway: FYI, valgrind does not support Obj-C GC: <http://bugs.kde.org/show_bug.cgi?id=208215> -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com