内存泄漏问题iOS

时间:2014-04-30 13:44:12

标签: ios object memory-leaks heap

我从下面的块中产生了内存泄漏。我很确定以下物品正在纠缠不清。我尝试用(弱)关系设置它们但是没有成功。关于如何打击/重写此问题的任何想法?感谢。

AssistHub.m

 @implementation

- (void)startGameWithBlock:(void (^)(Game *))block
{

     _viewControllerGame = [[GameViewController alloc] init];
     _viewControllerGame.delegate = (id)self;

     Game *game = [[Game alloc] init];
     _viewControllerGame.thisGame = game;
     game.delegate = _viewControllerGame;

     block(game);

}

1 个答案:

答案 0 :(得分:0)

请执行以下检查:

  1. 首先确保在需要时使用弱引用以避免内存保留周期。请参阅以下链接,该链接可以帮助您以更加简明的方式编写弱引用{。{3}}。

  2. 请确保您的代表也使用 。如果没有,你也会在那里造成一个循环。检查 _viewControllerGame.delegate + game.delegate = _viewControllerGame; *

相关问题