zoukankan      html  css  js  c++  java
  • OC12_自动释放池

    //
    //  Dog.h
    //  OC12_自动释放池
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    @interface Dog : NSObject
    
    @end
    
    
    
    //
    //  Dog.m
    //  OC12_自动释放池
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import "Dog.h"
    
    @implementation Dog
    
    - (void)dealloc
    {
        NSLog(@"dog is release");
        [super dealloc];
    }
    
    @end
    //
    //  main.m
    //  OC12_自动释放池
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    #import "Dog.h"
    
    int main(int argc, const char * argv[]) {
        NSMutableArray *releasePool=[[NSMutableArray alloc] init];
        
        Dog *xiaoBai = [[Dog alloc] init];
        [releasePool addObject:xiaoBai];
        [xiaoBai release];
        NSLog(@"xiaoBai = %li", xiaoBai.retainCount);
        
        Dog *xiaoHei = [[Dog alloc] init];
        [releasePool addObject:xiaoHei];
        [xiaoHei release];
        
        [releasePool release];
        
        return 0;
    }
  • 相关阅读:
    request和response使用
    oracle_to_char
    oracl_LTRIM_RITRIM
    convert
    jdbc
    oracle_trunc
    [python]glob模块中的glob()函数为什么返回空列表??
    win10 anaconda+tensorflow+keras
    Golang学习:sublime text3配置golang环境
    2018/12/05学习笔记
  • 原文地址:https://www.cnblogs.com/0515offer/p/4586984.html
Copyright © 2011-2022 走看看