• 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: Does cocoa just leak?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does cocoa just leak?


  • Subject: Re: Does cocoa just leak?
  • From: Vince DeMarco <email@hidden>
  • Date: Sun, 30 Sep 2001 10:50:11 -0700

On Saturday, September 29, 2001, at 08:37 pm, Rosyna wrote:

I was trying to do a mem test on my app today. First trying to get a base reading, before anything else occurred. So I have a window with a pulsing button on it connected to some action. Thats all I have on it. I launch the app, then go into top to see the mem usage. Ok. Then I switch back to my app and notice the mem usage goes up. Switch back to the terminal, mem usage goes back again. Try switching in and out again, nothing happens. I think, "Oh well, must be a fluke" So I switch in and out about 15 more times. After about every dozen or so switches mem usage goes up a few k. And this is with an App that wasn't doing anything.

To test my class I was doing:

for (i=0;i<5000;i++)
[instance URL];

This causes mem usage to go up about 500k. Thats not too bad, i guess. I set the URL thats returned to autorelease inside the class. However, doing:

for (i=0;i<5000;i++)
[[instance URL] path];

Reimplement the above like this

for(i=0;i<5000;i++){
NSAutoreleasePool *pool;

pool = [[NSAutoreleasePool alloc] init];

[instance ULR];

/* Do lots of other interesting stuff */

[pool release];
}

Everything should be okay now.

vince


  • Follow-Ups:
    • Re: Does cocoa just leak?
      • From: Deirdre Saoirse Moen <email@hidden>
References: 
 >Does cocoa just leak? (From: Rosyna <email@hidden>)

  • Prev by Date: Re: NSScrollView and general IB annoyance
  • Next by Date: Using Carbon Events in a Cocoa app
  • Previous by thread: Re: Does cocoa just leak?
  • Next by thread: Re: Does cocoa just leak?
  • Index(es):
    • Date
    • Thread