It is pretty easy actually, however it relies on an undocumented api call, so dont ship your app with it (even if it is in a non-accecable code path). All you have to do is: [[UIApplication sharedApplication] _performMemoryWarning];
This method will have the App's UIApplication object post the UIApplicationDidReceiveMemoryWarningNotification and call the applicationDidReceiveMEmoryWarning: method on the App Delegate and all UIViewController's
-(IBAction) performFakeMemoryWarning {
#ifdef DEBUG_BUILD
SEL memoryWarningSel = @selector(_performMemoryWarning);
if ([[UIApplication sharedApplication] respondsToSelector:memoryWarningSel]) {
[[UIApplication sharedApplication] performSelector:memoryWarningSel];
}else {
NSLog(@"%@",@"Whoops UIApplication no loger responds to -_performMemoryWarning")
}
#else
NSLog(@"%@",@"Warning: performFakeMemoryWarning called on a non debug build")
#endif
}