zoukankan      html  css  js  c++  java
  • Using Autorelease Pools

    There are, however, three occasions when you might use your own autorelease pools:

    1.  If you are writing a program that is not based on a UI framework, such as a command-line tool.

    2. If you write a loop that creats many temporary objects.

    3.  you spawn a secondary thread.  

    (2) Autorelease Pools and Threads

    Each thread in a Cocoa application maintains its own stack of NSAutoreleasePool objects. When a thread terminates, it automatically releases all of the autorelease pools associated with itself.

     

    (3) ownership

     * If you create an object, you own it.

     * If you get an object from somewhere else, you do not own it. if you want to prevent it being disposed of, you must add yourself as an owner.

     * If you are an owner of an object, you must relinquish ownership when you have finished using it.

  • 相关阅读:
    schema的详解
    递归删除文件
    如何写一个schema文件
    如何写一个dtd文件
    WebService随笔记录
    文件分割
    三级数据显示
    数据库锁表查询及解除方法
    list分页
    JXLS模板导出多个sheet文件
  • 原文地址:https://www.cnblogs.com/JiesonWu/p/2593488.html
Copyright © 2011-2022 走看看