• 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.
  • 相关阅读:
    JDK环境变量配置
    Leetcode 645. 错误的集合
    map、vector内存释放
    Leetcode 605. 种花问题(终于解决)
    QT自定义QTABLEWIDGET
    Qtcreator调试源码
    Eclipse安装教程
    C/C++常用工具库
    pandas目录
    Lesson3——Pandas Series结构
  • 原文地址:https://www.cnblogs.com/stronger-ios-lcx/p/5634968.html
Copyright © 2020-2023  润新知