Is there a way to set the amount of memory available in the iPhone Simulator?

时光毁灭记忆、已成空白 提交于 2019-11-30 05:58:31

问题


Does anyone know if its possible to set the amount of memory available in the simulator?

I'm assuming the simulator will use as much memory as possible from the system but this makes it more difficult to recreate certain low memory crashes/bugs.


回答1:


No it isn't possible.

Testing things like memory consumption and performance should be done on the device, not the simulator. Even if you could limit the memory in the simulator you wouldn't get the same effect as there are very many different factors that will dictate how much available memory any given iPhone device will currently have.

You can simulate a "memory warning" to test if your responses to that warning behave correctly, but other than that, you should really be testing this kind of thing on a physical device.




回答2:


You can invoke the "Simulate Memory Warning" in Simulator. Go to the "Hardware" pulldown menu. That's really about as far as you can go.




回答3:


Apple documentation states that you can only simulate the low memory warning.

Having said that, there are limitations when invoking from the menu. Here's a post that lets you better simulate real world scenarios when trying to invoke the warning: Easier low memory warning simulator testing with keyboard shortcuts

I agree with @Jasarien that trying to limit the memory within the simulator is an artificial test and should be done on the device.




回答4:


No this is not possible.

You can always simulate the memory warning situation. According to this you can also verify with the profiler how much memory your app is using see what limits you exceed.



来源:https://stackoverflow.com/questions/2545847/is-there-a-way-to-set-the-amount-of-memory-available-in-the-iphone-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!