when i analyse my projetc, Xcode analyser find some potential leak of an object allocated
but the trouble is that i don’t know what it means and how to resolve this
here is a picture of my file,

and here is the code
#import "RoundRect.h"
//
// NewPathWithRoundRect
//
// Creates a CGPathRect with a round rect of the given radius.
//
CGPathRef NewPathWithRoundRect(CGRect rect, CGFloat cornerRadius)
{
//
// Create the boundary path
//
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL,
rect.origin.x,
rect.origin.y + rect.size.height - cornerRadius);
// Top left corner
CGPathAddArcToPoint(path, NULL,
rect.origin.x,
rect.origin.y,
rect.origin.x + rect.size.width,
rect.origin.y,
cornerRadius);
// Top right corner
CGPathAddArcToPoint(path, NULL,
rect.origin.x + rect.size.width,
rect.origin.y,
rect.origin.x + rect.size.width,
rect.origin.y + rect.size.height,
cornerRadius);
// Bottom right corner
CGPathAddArcToPoint(path, NULL,
rect.origin.x + rect.size.width,
rect.origin.y + rect.size.height,
rect.origin.x,
rect.origin.y + rect.size.height,
cornerRadius);
// Bottom left corner
CGPathAddArcToPoint(path, NULL,
rect.origin.x,
rect.origin.y + rect.size.height,
rect.origin.x,
rect.origin.y,
cornerRadius);
// Close the path at the rounded rect
CGPathCloseSubpath(path);
return path;
}
Thanks for your very useful help.
PS: all my projet works fine in the iphone simulator
it’s an app, with a tabbar and 4 section, two section are empty yet,
and the two other section are tableview with detail view (data are picked from a plist)
When i test the app on my device, the two empty sections works perfectly, and juste one of the two tableview display the detailview, the second tableview witch works in the simulator did not push the detailview,
what made me mad is that it works fine this morning
A question:
is a plist limited by the data it contain, i mean that if a have a big list for example with 500 dictionary items, can this trouble the good display of the app ?
Thanks
When returning a CF/CG allocation, the function should be prefixed with
Create.I.e. rename your function
CreatePathWithRoundRect()and the analyzer should stop complaining.Note that you don’t want to collude autorelease with CG/CF types; that is, follow the patterns perpetuated by the framework containing the type of the object returned. Thus, returning a +1 retain count object from that function makes sense.