In addition to manually issuing a memory warning in the simulator, you can issue one programatically with
- (void)_simulateLowMemoryWarning {
// Send out MemoryWarningNotification
[[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification
object:[UIApplication sharedApplication]];
// Manually call applicationDidReceiveMemoryWarning
[[[UIApplication sharedApplication] delegate] applicationDidReceiveMemoryWarning:[UIApplication sharedApplication]];
}
You can then cause this to happen every 5 seconds using a timer
static NSTimer *gLowMemoryTimer = nil;
- (void)stopLowMemoryTimer {
[gLowMemoryTimer invalidate];
gLowMemoryTimer = nil;
}
- (void)startLowMemoryTimer {
if (gLowMemoryTimer) {
[self _stopLowMemoryTimer];
}
gLowMemoryTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(_simulateLowMemoryWarning) userInfo:nil repeats:YES];
}