Re: String memory leak
Re: String memory leak
- Subject: Re: String memory leak
- From: "Chris Lewis" <email@hidden>
- Date: Sat, 1 Apr 2006 14:33:41 +0100
One thing I just thought:
Try OmniObjectMeter and see if that helps (there is a trial key you
can get). It can show you the retain/release calls to an object. Often
I find that something I noticed was leaking somewhere was actually
just a symptom of a leak further up the chain. OOM is very great at
spotting these.
Cheers
Chris
On 4/1/06, Bruce Truax <email@hidden> wrote:
>
>
>
> On 4/1/06 8:15 AM, "Julio Cesar Silva dos Santos" <email@hidden>
> wrote:
>
> > 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.
>
> When it executes the GLASS method this marks the end of all of the
> information needed to define aSurface. At that point I add it to the
> surfaceArray and then initialize a new one which I then fill the next time
> through the loop.
>
> Bruce
>
> >
> > 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
>
> --
> ____________________________________________________________
> Bruce E. Truax email: email@hidden
> Optical Engineering Consultant
>
> Diffraction Limited Design LLC
> 388 Wedgewood Road voice: 860-276-0450
> Southington, CT 06489 fax: 860-620-9026
> http://www.dld-llc.com
> _____________________________________________________________
>
>
> _______________________________________________
> 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
>
_______________________________________________
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