I am using the leak instrument first time. i am getting two leaks in my code, when i saw the source code then it shows at these two bold statements....
- (id) initWithFrame: (CGRect) frame
{
[self LoadMoviePlayer];
**self= [super initWithFrame:frame];**
if (self==[super initWithFrame:frame])
{
CAEAGLLayer* eaglLayer = (CAEAGLLayer*) self.layer;
eaglLayer.opaque = YES;
- (void) applicationDidFinishLaunching: (UIApplication*) application
{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
**m_view = [[GLView alloc] initWithFrame: screenBounds];**
[m_window addSubview: m_view];
[m_window makeKeyAndVisible];
}
don't know what to do next to solve the problems.
From all I can see, the first leak happens when you execute code in an init without being initialized (your [super initWithFrame:]
happens after your [self loadMoviePlayer]
), the second, on first sight, seems to be m_view being allocated, but not released, you might solve it using:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
m_view = [[GLView alloc] initWithFrame: screenBounds];
[m_window addSubview: m_view];
[m_view release];
[m_window makeKeyAndVisible];
This should work, since the m_view has already being added to the window (and therefore retained).