I am making adobe air desktop app. I need to figure out how to do a long polling ajax request, without causing adobe air memory leak.
Basically my function is like this (i’m using jquery)
var stream = function() {
$.ajax({
url:"http://my-chat-server/stream",
success:function(data) {
//add recent msg to dom
add_msg(data);
stream();
}
});
}
My current implementation would fill 10mb in an hour and it’s bad. Anyone know how to do this?
Found it,
Use air.URLStream, described here (scroll to bottom, example are there):
http://help.adobe.com/en_US/air/reference/html/flash/net/URLStream.html#readUTF%28%29
after implementing air.URLStream, my app memory usage does not increase!
Using jquery ajax call will cause adobe air to leak memory – badly.