//imageRef = 2 here, as initWithCGImage is documented as retaining its
//imageRep = 1 due to alloc/init
My thinking is that imageRep = 1 here due to NSObject in Rococoa retaining
(and because initWithCGImage doesn't return the same
instance as alloc). I also notice that accidentally I was calling
initWithCGImage twice; that's been fixed now.
Now, I think Rococoa will release both imageRep and imageRef one more time
in finalize, meaning you are OK.
Can someone check my counts. I feel like there must be a slightly simpler
way to do this.
I don't think Rococoa would be releasing imageRef, as it's just an ID, but
it would get released on the ObjC side, due to Rococoa
releasing imageRep in finalize.