Yes, you need to program the free call yourself. However, your pointer can participate in the reference counting system indirectly if you put it in an instance of a reference counting object:
@interface MyObj : NSObject { int *buf; } @end @implementation MyObj -(id)init { self = [super init]; if (self) { buf = malloc(100*sizeof(int)); } } -(void)dealloc { free(buf); } @end
There is no way to write this call free - anyway, you must have it in your code.
dasblinkenlight
source share