probablycorey/wax

wax.http.request introdution memory leaks

Closed this issue · 1 comments

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@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

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.