2012-10-26 4 views
1

이것은 내가 UIImage을 생성하는 방법입니다. 나는 calloc으로 piOutData를 할당했다. 이제 CGImageRelease으로 전화하면 piOutData이 자동으로 해제되거나 무료로 수동 처리해야합니다. 내가 마지막에 CGImageRelease를 호출 할 때CGBitmapContextCreate 메모리 릴리즈 책임

int m_iH = iInMaxDim; 
int m_iW = iInMaxDim; 

UInt8*piOutData = calloc(iInMaxDim *iInMaxDim*4,sizeof(UInt8)); 
CGContextRef ctx = CGBitmapContextCreate(piOutData, 
             m_iW, 
             m_iH, 
              CGImageGetBitsPerComponent(inImage.CGImage), 
             m_iW*4, 
             CGImageGetColorSpace(inImage.CGImage), 
             CGImageGetBitmapInfo(inImage.CGImage) 
             ); 
CGImageRef imageRef = CGBitmapContextCreateImage(ctx); 
CGContextRelease(ctx); 
UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; 
CGImageRelease(imageRef); 

답변

1

는 ... 것이다 자동 piOutData을 해제?

No. piOutData은 (는) 귀하가 소유하고 있습니다.