You are right, you need to implement dealloc and call free inside it. dealloc will be called when the object is released as ARC. In addition, you cannot call [super dealloc]; as this will be done automatically.
Finally, note that you can use NSData to allocate memory for filled :
self.filledData = [NSMutableData dataWithLength:size.x * size.y * size.z]; self.filled = [self.filledData mutableBytes];
When you do this, you do not need to explicitly free the memory, as this will be done automatically when the object and, therefore, filledData are freed.
source share