• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trying to intentionally create a memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to intentionally create a memory leak


  • Subject: Re: Trying to intentionally create a memory leak
  • From: "Ken Ferry" <email@hidden>
  • Date: Fri, 7 Mar 2008 18:12:11 -0800

On Fri, Mar 7, 2008 at 2:59 PM, Sherm Pendley <email@hidden> wrote:
> On Fri, Mar 7, 2008 at 5:45 PM, Jake <email@hidden> wrote:
>
>  > I am trying to create a simple Cocoa app that has an intentional memory
>  > leak so that I can play with the development tools Instruments, MallocDebug
>  > and leaks to learn how to detect memory leaks.  I have a Cocoa console
>  > application that has code that I was sure would leak - [NSNumber alloc] with
>  > no corresponding release.   But when I run those tools I detect no leak.
>
>
>  NSNumber is a class cluster, so its +alloc is probably just returning a
>  singleton placeholder. Have you tried fully initializing the NSNumber
>  instances? Have you tried using NSObject instead?
>

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.

-Ken
_______________________________________________

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trying to intentionally create a memory leak
      • From: Bill Bumgarner <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>)

  • Prev by Date: force NSTextField to accept only Roman, or the other character codes
  • Next by Date: Re: force NSTextField to accept only Roman, or the other character codes
  • Previous by thread: Re: Trying to intentionally create a memory leak
  • Next by thread: Re: Trying to intentionally create a memory leak
  • Index(es):
    • Date
    • Thread