zoukankan      html  css  js  c++  java
  • ARC机制集合内存管理

    //

    //  main.m

    //  13-ARC机制集合内存管理

    //

    //  Created by apple on 14-3-21.

    //  Copyright (c) 2014年 apple. All rights reserved.

    //

    #import <Foundation/Foundation.h>

    #import "Person.h"

    //ARC机制,是否需要担心内存溢出呢

    //谁告诉你不用的心得啊:道理就是下面的示

    int main(int argc, const char * argv[])

    {

        @autoreleasepool {

            

            Person * p = [[Person alloc] init];

            

            NSMutableArray * array = [[NSMutableArray alloc] init];

            

            //当一个对象被存入集合中的时候,默认会保存它的强指针

            [array addObject:p];

            

            //当个把一个对象从集合中,删除的时候,会释放掉这个对象的强指针

    //        [array removeObject:p];

            

    //        [array removeAllObjects];

            

            array = nil;

            

            p = nil;

            

            NSLog(@"adfasdf");

            

        }

        return 0;

    }

  • 相关阅读:
    Perface(TCP/IP 协议族)
    CHAPTER 2 Database Environment
    Chapter 1 Introduction
    2. Instructions: Language of the computer (指令:计算机语言)
    sed命令
    磁盘配额
    外设,镜像
    磁盘及文件系统挂载
    网络客户端工具命令
    TCP协议
  • 原文地址:https://www.cnblogs.com/supper-Ho/p/6186204.html
Copyright © 2011-2022 走看看