• 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: String memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String memory leak


  • Subject: Re: String memory leak
  • From: Julio Cesar Silva dos Santos <email@hidden>
  • Date: Sat, 1 Apr 2006 10:15:03 -0300

You have some private class (aSurface) and there is no hint on how they are created and destroyed but one thing sounds weird: the line aSurface = [[ACSurface alloc] init] was put *after* you use the object. You cannot use an object *before* creating it. I do not know if this is the problem but certainly it is not correct.

Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
1GB RAM
Linux User #359973


On 01/04/2006, at 09:30, Bruce Truax wrote:

The command line tool "leaks" is telling me that I have an 80 byte leak of
type NSCFString everytime I execute the following method:


- (void)GLASS:(NSString *)parameterString
{
    [aSurface setGlass:[NSString stringWithFormat:
        @"GLASS %@", parameterString]];
    [aSurface setSurfaceNumber:surfaceNumber];
    surfaceNumber++;
    [surfaceArray    addObject:aSurface];
    aSurface = [[ACSurface alloc]init];

}

Here is the Leaks report:
Leak: 0x060d9410  size=80    instance of 'NSCFString'
    0xa073a674 0x0001078c 0x45474c41 0x5353204d     .s.t....EGLASS M
    0x4f44454c 0x20312e36 0x39313030 0x3230202d     ODEL 1.6910020 -
    0x312e3030 0x30303030 0x3030452d 0x30332020     1.00000000E-03
    0x302e3030 0x30303030 0x3030452b 0x30302020     0.00000000E+00
    0x302e3030 0x30303030 0x3030452b 0x30300054     0.00000000E+00.T

I assume that I am doing something wrong with memory management in the line:

   [aSurface setGlass:[NSString stringWithFormat:
        @"GLASS %@", parameterString]];

Should I be using the following instead?

  [aSurface setGlass:[[NSString alloc] initWithFormat:
        @"GLASS %@", parameterString]];

This really has me puzzled.

Thanks.

Bruce
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: String memory leak
      • From: Bruce Truax <email@hidden>
References: 
 >String memory leak (From: Bruce Truax <email@hidden>)

  • Prev by Date: Re: String memory leak
  • Next by Date: Re: String memory leak
  • Previous by thread: Re: String memory leak
  • Next by thread: Re: String memory leak
  • Index(es):
    • Date
    • Thread