Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASIInputStream leaks on iOS7 compiled by Xcode 5.0 #378

Open
msching opened this issue Oct 25, 2013 · 4 comments
Open

ASIInputStream leaks on iOS7 compiled by Xcode 5.0 #378

msching opened this issue Oct 25, 2013 · 4 comments

Comments

@msching
Copy link

msching commented Oct 25, 2013

dealloc is not called on iOS7 when a request has postbody. Profile the iphone sample with leaks, click upload tab and upload then you will find ASIInputStream is leaking.

@hisaoka
Copy link

hisaoka commented Nov 1, 2013

I check the memory leak in my environment as well. People who are looking how to handle someone do not come?

@mjohnson12
Copy link

The leak is because ASIInputStream is being cast to a CFReadStreamRef but ASIInputStream does not derive from NSInputStream it just wraps it.

My Solution is to get rid of ASIInputStream and create a NSInputStream instead in the ASIHTTPRequest startRequest: method.

It breaks using the metrics that ASIInputStream records but I wasn't using them.

I'm using a fairly old version of ASIHTTPRequest v.1.6.2 so your milage may vary.

@msching
Copy link
Author

msching commented Nov 6, 2013

it works! thanks a lot!
BTW, if I subclass NSInputStream using this: https://github.com/bjhomer/HSCountingInputStream/blob/master/HSCountingInputStream/HSCountingInputStream.m, will also fix the leaks and make the post request working. But it is overriding undocumented methods. Is there any risks when my app is submitted to Appstore?

@heroims
Copy link

heroims commented Dec 13, 2013

#382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants