Ios program memory

I want to test my application in low memory conditions. Previously, my approach to this was fulfilled

[NSTimer scheduledTimerWithTimeInterval:2.0 target:[UIApplication sharedApplication] selector:@selector(_performMemoryWarning) userInfo:nil repeats:YES]; 

but it no longer works. And by working, I mean that didReceiveMemoryWarning is not being called. I also tried:

  [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification object: [UIApplication sharedApplication]]; [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification object: nil]; [[UIApplication sharedApplication] _performMemoryWarning]; 

But none of the above work.

Any ideas would be appreciated.

+4
source share
2 answers

Take a look at this message. Is there a way to send a Memory Warning to the iPhone device manually?

Send programmatically: CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);

In the simulator:

Hardware → Imitation Memory Warning

+1
source

An easy way to check the memory warning code is to create a simulator and click

Hardware ==> Simulate memory alert

0
source

All Articles