iOS内存在app中不断增加似乎无缘无故
<p><p>这是我的应用的入口 ViewController 。</p>
<p>它开始使用大约 6.5mb 的内存,然后以每秒大约 0.1mb 的速度不断攀升。</p>
<p>我到底做错了什么?</p>
<p>据我所知,没有任何理由可以让任何代码持续泄漏,尤其是因为它每次都运行一次。 </p>
<p>此外,删除大部分内容似乎无济于事。想法?</p>
<pre><code>//
//ViewController.m
//Paddle Jumper
//
//Created by Chance Daniel on 1/18/14.
//Copyright (c) 2014 Max Hudson. All rights reserved.
//
//#import "Flurry.h"
#import "ViewController.h"
//#import "startViewController.h"
@implementation ViewController{
BOOL sceneSetUp;
}
- (void)viewWillLayoutSubviews
{
if(!sceneSetUp){
;
// Configure the view
SKView * skView = (SKView *)self.view;
//skView.showsFPS = YES;
skView.showsNodeCount = YES;
NSUserDefaults *defaults = ;
if([ intValue] != 1){
forKey:@"firstTime"];
;
forKey:@"ggrOwned"];
forKey:@"gona"];
forKey:@"points"];
forKey:@"livesLeftValue"];
forKey:@"shieldsLeftValue"];
forKey:@"lvlTwoLeftValue"];
forKey:@"lvlThreeLeftValue"];
}
if(!){
forKey:@"tut_game1"];
forKey:@"tut_store"];
forKey:@"tut_daily"];
}
;
// Create and configure the scene.
//SKScene * startScene = ;
//startScene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
//;
//;
sceneSetUp = YES;
}
}
-(void) switchScene{
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
if ([ userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskAllButUpsideDown;
} else {
return UIInterfaceOrientationMaskAll;
}
}
- (void)didReceiveMemoryWarning
{
;
// Release any cached data, images, etc that aren't in use.
}
@end
</code></pre>
<p> <img src="/image/R3hzP.jpg" alt="Instruments"/> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>问题是你打开了僵尸。造成泄漏正是僵尸所做的! (“僵尸做什么”似乎是错误的......)它的全部目的是防止对象被释放。当僵尸(是?)打开时,您永远不应该检查内存使用情况。</p></p>
<p style="font-size: 20px;">关于iOS内存在app中不断增加似乎无缘无故,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22317374/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22317374/
</a>
</p>
页:
[1]