I often try to fix errors that occur when I use my iphone for other puzzles, and he needs to free up some memory and thus unload some views from my application. It was quite difficult for me to imitate when I needed it, so I decided to do this, trying to allocate as much memory as possible and force my tested application to free unused views, etc.
I tried something simple, like calling it every few hundred milliseconds, but for some reason I didnβt do anything
[[NSData alloc] initWithBytes:malloc(2048 * 1024) length:2048 * 1024];
The tools show that applications are becoming more and more, far exceeding the amount of iphone memory (hundreds of allocated mbs), but I do not even receive a memory warning and generally do not affect other applications. Is there some kind of protection that somehow prevents the iphone application form creation? Or is there some kind of error in my assumptions about how the iphone works? How do you solve this problem when you come across it?
EDIT: I run my application on the device, I could not parse my views on the simulator, even if I modeled a warning about memory (this sometimes works, but only rarely)
EDIT2: since the problem with bbum was really in virtual distribution, a simple memset after the allocation did the trick
void *data = malloc(1024 * 1024); memset(data, 0, 1024 * 1024);
memory-management iphone
Lope
source share