考虑以下:
typedef struct
{
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
} Matrix;
@interface TestClass : NSObject
{
Matrix matrix;
}
- (TestClass *) init;
@end
@implementation TestClass
- (TestClass *) init
{
self = [super init];
matrix = (Matrix) {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
return self;
}
@end
当“矩阵”变量不再相关时(或当整个对象被释放时),如何确保正确释放结构分配的 64 个字节?