In MacOs, you can see free, wired, active, inactive memory status by Activity Monitor. And, you can use commandline like "purge" to purge the memory.

Then, Can I do this in iOS? I am not familiar with Mach/BSD. And, Can someone else help me?

In Mac Osx, I can convert the inactive to free using following method.

char command_line[256];
sprintf(command_line, "purge");
FILE *fp = popen(command_line, "r");
if (fp) {
    pclose(fp);
}
有帮助吗?

解决方案

When your app allocates memory iOS automatically free requested amounts of memory by alerting other apps with special messages (memory warnings) and by unloading other apps. If your app requesting too much memory - it will be unloaded by iOS with special crash type.

There is no way to purge memory with user request on iOS platphorm. In order of public api terms.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top