imageRepWithData memory management

  • Hi

    I find it difficult to find documentation at Apple dev. what happens
    in this case:

    NSBitmapImageRep *image = [NSBitmapImageRep imageRepWithData:
    [myNSImage TIFFRepresentation]];

    According to documentation:
    Creates and returns an NSBitmapImageRep object initialized with the
    first image in the supplied data.

    But my question is what about release? Or is the object from
    imageRepWithData autorelease?

    Further what is happening to the NSData object that is createdby
    TIFFRepresentation, is it autoreleas?

    Or is the NSData object released when the NSBitmapImageRep object is
    release?

    Thank you
  • > NSBitmapImageRep *image = [NSBitmapImageRep imageRepWithData:
    > [myNSImage TIFFRepresentation]];
    >
    > According to documentation:
    > Creates and returns an NSBitmapImageRep object initialized with the
    > first image in the supplied data.
    >
    > But my question is what about release? Or is the object from
    > imageRepWithData autorelease?
    >
    > Further what is happening to the NSData object that is createdby
    > TIFFRepresentation, is it autoreleas?

    Hello,

    As long as you don’t send the alloc, copy, retain or new messages,
    you should not have to bother with memory management,
    especially with class (or "convenience") methods
    --those beginning with a "+"-- like imageRepWithData: .

    Have a look:

    file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html

    Flofl.
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today