I am trying to simulate memory warning in ios project. But when used memory reaches to around 600 MB I am getting "Message from debugger: Terminated due to memory issue #1" on debugger. Same is working on objective C. Please refer this question for more details. I have tried by both ways as described by @Martin R.
I am using a timer to allocate 1MB memory in every 1 second to allocate all the available memory in iPHone and generate memory warning.
Here is the objective C code using malloc
p[allocatedMB] = malloc(1048576);
memset(p[allocatedMB], 0, 1048576);
allocatedMB += 1;