{"action":"created","issue":{"url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/9","labels_url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/9/comments","events_url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/9/events","html_url":"https://github.com/BloodAxe/OpenCV-Tutorial/issues/9","id":53031118,"number":9,"title":"getting memory warning","user":{"login":"kalpesh22m","id":3585475,"avatar_url":"https://avatars.githubusercontent.com/u/3585475?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpesh22m","html_url":"https://github.com/kalpesh22m","followers_url":"https://api.github.com/users/kalpesh22m/followers","following_url":"https://api.github.com/users/kalpesh22m/following{/other_user}","gists_url":"https://api.github.com/users/kalpesh22m/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpesh22m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpesh22m/subscriptions","organizations_url":"https://api.github.com/users/kalpesh22m/orgs","repos_url":"https://api.github.com/users/kalpesh22m/repos","events_url":"https://api.github.com/users/kalpesh22m/events{/privacy}","received_events_url":"https://api.github.com/users/kalpesh22m/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-12-29T10:09:38Z","updated_at":"2015-08-29T12:54:35Z","closed_at":"2015-08-29T12:54:35Z","body":"\r\nI am using opencv framework for flood fill . It works perfectly but after some time getting memory warning ..\r\n\r\nI am testing my app for leakages. I notice that my app grows by 3 to 4 mb each time I run my opencv functions.\r\n\r\nCode For IPL image to UIImage:\r\n\r\n- (UIImage *)UIImageFromIplImage:(IplImage*)image {\r\n\r\nCGColorSpaceRef colorSpace;\r\n\r\nif (image->nChannels == 1) {\r\n    colorSpace = CGColorSpaceCreateDeviceGray();\r\n}\r\nelse {\r\n    colorSpace = CGColorSpaceCreateDeviceRGB();\r\n    cvCvtColor(image, image, CV_BGR2RGB);\r\n}\r\n\r\nNSData *data = [NSData dataWithBytes:image->imageData length:image->imageSize];\r\nCGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)data);\r\nCGImageRef imageRef = CGImageCreate(image->width,\r\n                                    image->height,\r\n                                    image->depth,\r\n                                    image->depth * image->nChannels,\r\n                                    image->widthStep,\r\n                                    colorSpace,\r\n                                    kCGImageAlphaNone|kCGBitmapByteOrderDefault,\r\n                                    provider,\r\n                                    NULL,\r\n                                    false,\r\n                                    kCGRenderingIntentDefault\r\n                                    );\r\nUIImage *ret = [UIImage imageWithCGImage:imageRef];\r\n\r\nCGImageRelease(imageRef);\r\nCGDataProviderRelease(provider);\r\nCGColorSpaceRelease(colorSpace);\r\n\r\ndata=nil;\r\nreturn ret;\r\n}\r\n\r\nCode For UIImage to IPL image\r\n\r\n- (IplImage*)IplImageFromUIImage:(UIImage*)image {\r\n\r\nCGImageRef imageRef = image.CGImage;\r\nCGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();\r\nIplImage *iplimage = cvCreateImage(cvSize(image.size.width,image.size.height), IPL_DEPTH_8U, 4 );\r\n\r\nCGContextRef contextRef = CGBitmapContextCreate(\r\n                                                iplimage->imageData,\r\n                                                iplimage->width,\r\n                                                iplimage->height,\r\n                                                iplimage->depth,\r\n                                                iplimage->widthStep,\r\n                                                colorSpace,\r\n                                                kCGImageAlphaPremultipliedLast|kCGBitmapByteOrderDefault\r\n                                                );\r\n\r\nCGContextDrawImage(contextRef,CGRectMake(0, 0, image.size.width, image.size.height),imageRef);\r\n\r\nCGContextRelease(contextRef);\r\nCGColorSpaceRelease(colorSpace);\r\n\r\nretImage = cvCreateImage(cvGetSize(iplimage), IPL_DEPTH_8U, 3);\r\ncvCvtColor(iplimage, retImage, CV_RGBA2BGR);\r\ncvReleaseImage(&iplimage);\r\niplimage =nil;\r\nreturn retImage;\r\n}\r\n\r\n![screen shot 2014-12-29 at 1 49 38 pm](https://cloud.githubusercontent.com/assets/3585475/5567761/1e1f10da-8f71-11e4-90c3-1d4a39d8ada2.png)\r\n"},"comment":{"url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/comments/135983147","html_url":"https://github.com/BloodAxe/OpenCV-Tutorial/issues/9#issuecomment-135983147","issue_url":"https://api.github.com/repos/BloodAxe/OpenCV-Tutorial/issues/9","id":135983147,"user":{"login":"BloodAxe","id":532320,"avatar_url":"https://avatars.githubusercontent.com/u/532320?v=3","gravatar_id":"","url":"https://api.github.com/users/BloodAxe","html_url":"https://github.com/BloodAxe","followers_url":"https://api.github.com/users/BloodAxe/followers","following_url":"https://api.github.com/users/BloodAxe/following{/other_user}","gists_url":"https://api.github.com/users/BloodAxe/gists{/gist_id}","starred_url":"https://api.github.com/users/BloodAxe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BloodAxe/subscriptions","organizations_url":"https://api.github.com/users/BloodAxe/orgs","repos_url":"https://api.github.com/users/BloodAxe/repos","events_url":"https://api.github.com/users/BloodAxe/events{/privacy}","received_events_url":"https://api.github.com/users/BloodAxe/received_events","type":"User","site_admin":false},"created_at":"2015-08-29T12:54:35Z","updated_at":"2015-08-29T12:54:35Z","body":"ARC has been enabled for OBJ-C types and with a new OpenCV version this issue should be fixed by now."}}