#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
NSMutableArray *_mArray;
NSMutableArray *temp;
}
@property(nonatomic ,retain)NSMutableArray *mArray;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize mArray = _mArray;
-(void)reResultRetainCount{
static int i = 1;
NSLog(@"get %d _mArray retain count %d",i++,[_mArray retainCount]);
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// [self reResultRetainCount];
//
// _mArray = [[NSMutableArray alloc] init];
//
// [self reResultRetainCount];
//
// [_mArray release];
[self reResultRetainCount];
_mArray = [[NSMutableArray alloc] init];
[self reResultRetainCount];
[self.mArray addObject:@"123"];
[self.mArray addObject:@"456"];
[self.mArray addObject:@"789"];
/*
NSLog(@"%@",self.mArray);
[_mArray removeAllObjects];
NSLog(@"%@",self.mArray);
*/
[self reResultRetainCount];
NSLog(@"%@",_mArray);
temp = [_mArray copy];
[_mArray release];
[self reResultRetainCount];
if (temp) {
//NSLog(@"temp");
NSLog(@"%@",temp);
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//
//-(void)setMArray:(NSMutableArray *)mArray{
//
// if (_mArray != mArray) {
//
// //_mArray = mArray;
//
// [_mArray release];
// _mArray = [mArray retain];
//
// }
//
// NSLog(@" set mArray retain count %d",[mArray retainCount] );
//
//}
@end
总结,不需要。在跑道dealloc 里面去释放的时候,再去removeallobjects。
最多,加上 currentObjets = nil这句话。
安全释放。合理分配。
共享内存,不要随便放。
和同事辩论,结果,V字手势。
分享到:
相关推荐
gRPC使用demo(只测试Release版本)
完整版spring-framework-4.1.6
rpmforge是Dag、Dries 和其它软件包的组合。它们为 CentOS 提供了超过10000个软件包。rpmforge不是redhat Linux产品或 CentOS 的组成部分,但它是为这些 Linux 套件而设计的。
EMQPLUS企业版是基于Erlang/OTP开发的MQTT消息服务器,具备百万级高并发、毫秒级低时延、分布式集群和高可靠性等特性,适用物联网、车联网、智能硬件和移动消息等场景。 目前已广泛应用在全球市场,包括中国、北美、...
Qt Release 版本下 崩溃测试 demo 可以定位到程序崩溃点
app-release.apk 测试
ecshop V3.0版本 官方正版,PHP购物商城系统
JetbrainsCrack-3.1-release-enc.jarJetbrainsCrack-3.1-release-enc.jarJetbrainsCrack-3.1-release-enc.jarJetbrainsCrack-3.1-release-enc.jarJetbrainsCrack-3.1-release-enc.jarJetbrainsCrack-3.1-release-enc...
spring-context-3.2.4.RELEASE.jar spring-core-3.2.4.RELEASE.jar spring-beans-3.2.4.RELEASE.jar spring-test-3.2.4.RELEASE.jar spring-web-3.2.4.RELEASE.jar spring-aop-3.2.4.RELEASE.jar spring-webmvc-...
开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE...
包含翻译后的API文档:spring-webmvc-5.2.15.RELEASE-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.springframework:spring-webmvc:5.2.15.RELEASE; 标签:springframework、spring、webmvc、中文文档、jar...
开发工具 框架JAR spring-framework-4.3.6.RELEASE-dist开发工具 框架JAR spring-framework-4.3.6.RELEASE-dist开发工具 框架JAR spring-framework-4.3.6.RELEASE-dist开发工具 框架JAR spring-framework-4.3.6....
包含翻译后的API文档:spring-boot-2.3.12.RELEASE-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.springframework.boot:spring-boot:2.3.12.RELEASE; 标签:springframework、boot、spring、中文文档、jar包...
command + shift + G 前往文件夹 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 将更新包解压进去即可,如有问题,请私信我
webtatic-release.rpm Install Howto Download latest webtatic-release rpm from http://repo.webtatic.com/yum/el7/x86_64/ Install webtatic-release rpm: # rpm -Uvh webtatic-release*rpm Install ...
app-release app-release app-release app-release app-release
spring-aop-4.1.6.RELEASE.jar spring-aspects-4.1.6.RELEASE.jar spring-beans-4.1.6.RELEASE.jar spring-context-4.1.6.RELEASE.jar spring-context-support-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar ...
包含翻译后的API文档:spring-context-5.2.15.RELEASE-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.springframework:spring-context:5.2.15.RELEASE; 标签:springframework、spring、context、中文文档、...
EEMBC porting guide and release note , eembc 程序移植手册和发布日志
包含翻译后的API文档:spring-data-redis-2.0.9.RELEASE-javadoc-API文档-中文(简体)-英语-对照版.zip; Maven坐标:org.springframework.data:spring-data-redis:2.0.9.RELEASE; 标签:springframework、data、...