Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to intentionally create a memory leak



On Mar 7, 2008, at 6:12 PM, Ken Ferry wrote:
Also, it happens that numbers -1 through 12 (I think) are uniqued, so
[[NSNumber alloc] initWithInteger:5] won't leak either.

This isn't something to count on, of course.

In general, if you want to leak something on purpose, leak NSObjects or subclasses. The mutable collection classes are are relatively non- surprising to leak, too.


If you want some real fun, set up a couple of timers that call various methods at non-integral intervals (so you get beating effects) that do different, non-synchronizing, things to your state. Then add threads.

Then try and figure out how to use the debugging tools to figure out what went wrong.

malloc_history is a huge help.

Also, you'll probably want to turn on MallocScribble to wipe out any bits of diagnostic help done by the runtime so as to better simulate real world debugging in production systems.

b.bum

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >Trying to intentionally create a memory leak (From: Jake <email@hidden>)
 >Re: Trying to intentionally create a memory leak (From: "Sherm Pendley" <email@hidden>)
 >Re: Trying to intentionally create a memory leak (From: "Ken Ferry" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.