1

初めてリーク機器を使用しています。コードに2つのリークがあります。ソースコードを見ると、これらの2つの太字のステートメントに表示されます。

- (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];
}

問題を解決するために次に何をすべきかわからない。

4

1 に答える 1

0

私が見ることができるすべてから、最初のリークは、初期化せずに init でコードを実行したときに発生します (あなたはあなたの[super initWithFrame:]後に発生します[self loadMoviePlayer])。 :

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];

m_view は既にウィンドウに追加されている (したがって保持されている) ため、これは機能するはずです。

于 2011-07-05T09:28:43.960 に答える