このコードの問題は、whileループが実行されているときに、メモリ使用量が継続的に増加していることです。このコードがwhileループのときにメモリを増やし続ける理由を知りたいです。ここのどのオブジェクトが記憶を食べていますか。ループ内でメモリが増加しないようにするにはどうすればよいですか。
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSNumber *totalTime = [[self nowPlayingItem] valueForProperty:MPMediaItemPropertyPlaybackDuration];
while (self.currentPlaybackTime < [totalTime floatValue])
{
NSNumber *currentTime = [[NSNumber alloc] initWithFloat:self.currentPlaybackTime];
if([[NSThread currentThread] isCancelled])
{
[NSThread exit];
[newThread release];
}
else if([totalTime intValue] - [currentTime intValue] == 1.0)
{
if(currentTime)
[currentTime release];
break;
}
[currentTime release];
}
[pool release]