|  |      1Kai      2012-05-05 00:58:12 +08:00  1 试试看 [copy autorelease]; | 
|      2kejinlu      2012-05-05 01:02:05 +08:00  1 你这个很明显的内存泄露啊,谁创建谁负责释放,所以 return [copy autorelease]; 或者创建的时候 PostImageModal *copy=[[[[self class] allocWithZone:zone] init] autorelease]; | 
|  |      4adow OP | 
|  |      8xesique      2012-05-05 12:04:01 +08:00  1 依照Objective-C方法命名的惯例,调用以alloc、new、copy、mutableCopy等开头的方法名时,需要由调用方进行release操作。因此,copyWithZone:的实现应该不应返回autorelease的对象。 参见 https://discussions.apple.com/thread/296134?threadID=296134 https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html | 
|      9kejinlu      2012-05-05 12:06:19 +08:00  1 嗯 应该是调用方去释放 我之前说错了 | 
|  |      11xesique      2012-05-05 12:18:28 +08:00 至于LZ说的leaks我怀疑是其他地方导致的泄漏,分配行为是在copyWithZone:中的,因而Instruments会报告这里泄漏。 | 
|  |      13adow OP 恩的确是在外面泄露了,赋值给别的地方的一个property 的时候,retain 了一下,而那个property 本身应该是retain的 |