zoukankan      html  css  js  c++  java
  • iOS开发——面试篇&面试总结(六)内存问题

    内存问题

    一:手机内存容量

    • 最新苹果手机iPhone6s(plus)现在有2GB运行内存。
    • iPhone5、iPhone5s和iPhone6(plus)运行内存为1GB。
    • iPhone4和iPhone4s运行内存为512MB。

    二:App运行内存

    • 建议不要超过 10M. 如果用户 只运行一个程序 内存是用可以到 30M 左右. 
    • 不过这概率 几乎不可能. 
    • 一般 超过 10M 就会 memory warning L1 系统会 kill 一些不用的 view 


    外国大牛的测试结果
    So it turns out if you allocate (and use!) around 46-50 MB in your iPhone application it will just get terminated.

    如何保持内存(运行)占用不要太高?

      • 1. tableviewCell中的icon图片要用剪裁过的, 不要把那些1M左右的图片直接从web端传输过来
      • 2. 一些比较深,或者循环比较多的代码block中, 尽量在外围套一层autorelease pool, 执行完毕后直接[pool drain]
      • 3. tableview cell一定要reuse, 其他类似的view也要reuse.
    本博客,专属!本博文由博主独立编写或者借鉴别人的好文章进行修改而成,如果不对的地方望指正,谢谢!
  • 相关阅读:
    Golang-单元测试
    Golang-Json序列化和反序列化
    Golang-文件操作
    Golang-demo
    Golang-demo练习
    Golang-类型断言
    Golang-面向对象编程三大特性-多态
    Golang-接口(interface)
    Golang-面向对象编程三大特性-继承、多重继承
    块状元素和内联元素 【转】
  • 原文地址:https://www.cnblogs.com/stronger-ios-lcx/p/5629793.html
Copyright © 2011-2022 走看看