Skip to content

Instantly share code, notes, and snippets.

@yllan
Created July 29, 2011 07:22
Show Gist options
  • Select an option

  • Save yllan/1113367 to your computer and use it in GitHub Desktop.

Select an option

Save yllan/1113367 to your computer and use it in GitHub Desktop.
How could this leak?
// How could this leaking?
// self.request is a ASIHttpRequest
[self.request setDataReceivedBlock: ^(NSData *receivedData) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
[intermediateData appendData: receivedData];
if (CFAbsoluteTimeGetCurrent() - lastUpdateTime >= updateThreshold) {
CGImageSourceUpdateData(partialImageSource, (CFDataRef)intermediateData, false);
CGImageRef partialImage = NULL;
partialImage = CGImageSourceCreateImageAtIndex(partialImageSource, 0, NULL); // Instruments say this line leaks,
CGImageRelease(partialImage); // But I release partialImage immediately.
lastUpdateTime = CFAbsoluteTimeGetCurrent();
}
[pool drain];
}];
/* Instrument Leak Report
Leaked Object # Address Size Responsible Library Responsible Frame
,12 < multiple > 192 Bytes ImageIO readPropLong
,8 < multiple > 128 Bytes ImageIO readPropRtnl
NSCFString,8 < multiple > 320 Bytes ImageIO readProps
Malloc 16 Bytes,6 < multiple > 96 Bytes ImageIO readPropShort
?,6 < multiple > 288 Bytes ImageIO CGImagePlusCreateWithSession
Malloc 64 Bytes,6 < multiple > 384 Bytes ImageIO CGImagePlusSetGeometry
,6 < multiple > 672 Bytes ImageIO CGImagePlusCreateWithSession
Malloc 64 Bytes,6 < multiple > 384 Bytes ImageIO CGImagePlusSetGeometry
Malloc 16 Bytes,6 < multiple > 96 Bytes ImageIO readPropShort
?,6 < multiple > 288 Bytes ImageIO readPropShort
,6 < multiple > 96 Bytes ImageIO CGImagePlusSetGeometry
,6 < multiple > 96 Bytes ImageIO CGImagePlusSetGeometry
,6 < multiple > 96 Bytes ImageIO readPropShort
,6 < multiple > 96 Bytes ImageIO copyTiffPropertiesToRoot
,5 < multiple > 80 Bytes ImageIO CGImageReadSessionCreate
?,5 < multiple > 240 Bytes ImageIO readJFIFData
Malloc 96 Bytes,5 < multiple > 480 Bytes ImageIO readPropShort
Malloc 32 Bytes,5 < multiple > 160 Bytes ImageIO readPropShort
Malloc 96 Bytes,5 < multiple > 480 Bytes ImageIO readPropShort
Malloc 96 Bytes,5 < multiple > 480 Bytes ImageIO CGImagePlusCreateWithSession
?,5 < multiple > 240 Bytes ImageIO readPropShort
Malloc 96 Bytes,5 < multiple > 480 Bytes ImageIO readJFIFData
,5 < multiple > 80 Bytes ImageIO copyTiffPropertiesToRoot
Malloc 32 Bytes,4 < multiple > 128 Bytes ImageIO readJFIFData
Malloc 48 Bytes,4 < multiple > 192 Bytes ImageIO readJFIFData
,4 < multiple > 704 Bytes ImageIO CGImageReadCreateWithData
,4 < multiple > 128 Bytes ImageIO readJFIFData
Malloc 32 Bytes,4 < multiple > 128 Bytes ImageIO readJFIFData
Malloc 32 Bytes,4 < multiple > 128 Bytes ImageIO readPropShort
,4 < multiple > 64 Bytes ImageIO readJFIFData
,4 < multiple > 64 Bytes ImageIO readJFIFData
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment