【问题标题】:Is there any way to set simulator to work on limited memory? [duplicate]有没有办法让模拟器在有限的内存上工作? [复制]
【发布时间】:2014-01-22 02:36:58
【问题描述】:

众所周知,模拟器的内存比设备多。通常对于unit testing,每个开发人员在设备上测试项目之前使用模拟器,但有时在设备不可用的情况下,这是否可以在有限的内存上设置模拟器工作?

例如,工具栏中是否有任何选项可以将模拟器的内存设置为 16GB/32GB 内存,这样如果我们将内存限制设置为 16GB,它将以与具有 16Gb 内存的 iPad 相同的方式工作。

【问题讨论】:

  • 模拟器复制计算机。模拟器模仿计算机。因为模拟器在底层是完全不同的,所以计算内存使用会非常困难。因此,此功能不会也永远不会实现。您必须使用分配工具和眼球内存使用情况。
  • 嗯,谢谢大家.. 非常有用的信息...!!!!
  • 请注意,模拟器中有一个选项可以模拟内存警告。这对于测试响应内存警告的代码很有用。
  • 请注意,16/32GB 是这些设备可用的闪存,而不是内存。在谈论内存、内存警告等时,我们指的是 RAM。无论闪存如何,每一代手机都有相同数量的 RAM(通常比前一代多,但并非总是如此)。

标签: ios ios-simulator xcode5


【解决方案1】:

我想这会解决你的问题:-
Is there a way to set the amount of memory available in the iPhone Simulator?

更新(复制以下链接的内容):-
https://discussions.apple.com/thread/3870841?tstart=0

不可能。模拟器是一个 OS X 应用程序,因此您无法控制内存分配。有关详细信息,请在此处阅读有关 OS X 内存管理的部分: https://developer.apple.com/library/ios/#documentation/Performance/Conceptual/ManagingMemory/ManagingMemory.html#//apple_ref/doc/uid/10000160i.

更新 2:-
Even though iOS Simulator is a useful tool, never make it the only way you test an app. Because iOS Simulator is an app running on a Mac, it has access to the computer’s memory, which is much greater than the memory found on a device. As a result of the increased memory, iOS Simulator is not an accurate test of an app’s memory usage. For this same reason, you should always test the performance of your app’s user interface (UI) on a device. In iOS Simulator, your app’s UI may appear to run both faster and smoother than on a device.
参考链接:-https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html

【讨论】:

  • 您应该在此处复制这些链接的内容,以防链接损坏。否则,您的答案可能会被标记为“不是答案”并被删除。
  • 是的,我应该这样做,但是上面的链接可以正常工作。感谢您提供信息。
  • @PiyushDubey:这些链接现在可以正常工作,但将来可能会停止工作。这就是为什么引用链接文章中最重要/最相关的部分被认为是最佳实践的原因:如果链接停止工作,您的答案对未来的访问者将变得毫无用处。 (例外是指向 StackOverflow 问题/答案的链接;您不需要引用这些)
猜你喜欢
  • 2015-09-19
  • 1970-01-01
  • 1970-01-01
  • 2012-05-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-21
  • 1970-01-01
相关资源
最近更新 更多