Featured post
iphone - How i solve memory leak problem? -
i developing simple application in design or make code in creating , instance object of uiimage. when swip on ipad screen make image of sreen , image render uiimage object after image set uiimageview object , uiimage object released. every time swipe on screen , above process again , again. give me leak in renderimage = [[uiimage alloc] init];
.
code,
_renderimage = [[uiimage alloc] init]; _textimagev = [[uiimageview alloc] init]; [self renderintoimage]; -(void)renderintoimage { uigraphicsbeginimagecontext(bgtableview.bounds.size); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; _renderimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); } _textimagev.image = _renderimage; [_renderimage release];
after completing process of swipe releasing _textimagev.
how solve memory leak problem in uiimage *_renderimage?
on line:
_renderimage = uigraphicsgetimagefromcurrentimagecontext();
uigraphicsgetimagefromcurrentimagecontext()
returns new autoreleased uiimage
, points _renderimage
ivar it. allocated uiimage
never released, variable repointed somewhere else.
this abandoned uiimage
causes/is memory leak. should either release before pointing _renderimage
else, or not allocate in first place.
- Get link
- X
- Other Apps
Comments
Post a Comment