I have an application that I call eater memory, which is designed to force the removal of other os applications. It does this by consuming a lot of memory over time, until it stops due to memory pressure. In order to consume memory, I basically make copies of JPEG data representations:
-(IBAction)didTapStartButton:(id)sender{ int i = 200; while (i>0) { NSData* data = [UIImagePNGRepresentation(self.image) mutableCopy] ; [self.array addObject:[[data description] mutableCopy]]; [self.array addObject:data]; i--; } }
This was done completely with trial and error, and I assume that there is an easier way to consume a lot and a lot of memory.
source share