socket.IO-objc icon indicating copy to clipboard operation
socket.IO-objc copied to clipboard

Fix to memory leak found during profiling application

Open jasonbodie opened this issue 11 years ago • 6 comments

During profiling we found a memory leak in our app. The Leak pointed to how the dispatch_source_t was being managed. These changes seemed to cleanly resolve the leak issue and are in line with Apple’s usage documentation.

jasonbodie avatar Jul 08 '14 17:07 jasonbodie

@sroze This is the updated pull request.

jasonbodie avatar Jul 08 '14 17:07 jasonbodie

this is available on ARC?

dispatch_release(_timeout); this statements is not allowed on ARC.

breaklee avatar Jul 14 '14 08:07 breaklee

haven't tried it yet, but what I found: http://stackoverflow.com/questions/8618632/does-arc-support-dispatch-queues/8619055#8619055

seems like this PR would break everything above iOS 6.0 or Mac OS X 10.8

pkyeck avatar Jul 14 '14 08:07 pkyeck

thats good article. ill try it

breaklee avatar Jul 14 '14 09:07 breaklee

I talked about this in here: https://github.com/pkyeck/socket.IO-objc/pull/195

We have been seeing more memory leaks reports and I don't think there is any memory leaks in iOS7 by using ARC. I always check it and my usage is heavy.

If we sure there is no memory leaks in iOS7+ARC it should be something in reading about this in READ.ME to prevent reporting this issue over and over again.

maziyarpanahi avatar Jul 14 '14 10:07 maziyarpanahi

@maziyarpanahi I closed my original request prior to your earlier comments and created this request because I was asked to squash down to one commit. So essentially this is the original pull request not an "over and over again"...

This change does not cause problems when compiling and according to the apple documentation should, at worse, have no effect. Yet it does resolve the memory leak we are seeing in the profiler. I am also using iOS7 and ARC.

jasonbodie avatar Jul 14 '14 10:07 jasonbodie