有没有办法设置iPhone模拟器中可用的内存量?

时间:2021-02-25 16:58:56

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.

我假设模拟器将尽可能多地从系统中使用内存,但这使得重新创建某些低内存崩溃/错误变得更加困难。

4 个解决方案

#1


19  

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.

应该在设备上进行内存消耗和性能测试,而不是模拟器。即使您可以限制模拟器中的内存,也不会获得相同的效果,因为有很多不同的因素将决定任何给定的iPhone设备当前可用的内存量。

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


6  

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


4  

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

Apple文档声明您只能模拟低内存警告。

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.

我同意@Jasarien,试图限制模拟器中的内存是一个人工测试,应该在设备上完成。

#4


2  

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.

您始终可以模拟内存警告情况。根据这一点,您还可以通过分析器验证您的应用程序使用了多少内存,了解您超出的限制。

#1


19  

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.

应该在设备上进行内存消耗和性能测试,而不是模拟器。即使您可以限制模拟器中的内存,也不会获得相同的效果,因为有很多不同的因素将决定任何给定的iPhone设备当前可用的内存量。

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


6  

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


4  

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

Apple文档声明您只能模拟低内存警告。

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.

我同意@Jasarien,试图限制模拟器中的内存是一个人工测试,应该在设备上完成。

#4


2  

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.

您始终可以模拟内存警告情况。根据这一点,您还可以通过分析器验证您的应用程序使用了多少内存,了解您超出的限制。