wax.http.request introdution memory leaks #17

Open
nuxlli opened this Issue Jan 27, 2011 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

nuxlli commented Jan 27, 2011

Hi,

We are using the wax in a project feed reader, as it does recursive HTTP requests (an average of 12 every 10 minutes), we shall find a memory leak in code wax.http.request.

The problem happens due to a quirk in the way NSURLConnection performs asynchronous requests. Briefly, the problem happens because of an extra retain it makes when it receives a message like: initWithRequest:delegate:startImmediately, as it needs to retain the delegate for the future answer this ends up confusing the gc of the wax.

A temporary solution was to execute a release in properties of wax_http_request class: nuxlli/wax@5dbff70

This solution does not solve the whole problem, as an instance of wax_http_request still gets lost, but in our case has saved a lot of memory.
I believe in a refactory wax_http_request, so that the delegate is not the class itself, would be the best solution.

What do you think?

Everton

Owner

probablycorey commented Feb 7, 2011

Gah! NSURLConnection delegates and their memory management always fool me! This looks like a good temp fix.

A refactor is definitely in order. I'll take a look at reproducing the bug and trying to get a fix in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment