Everytime I make an Ajax request (jQuery) in Adobe Air and loading an image from an external url, the private memory usage increases. Is there any way to disable the cache of images or purge cached files?
Example:
$.ajax({
type: 'get',
url: someurl,
success: function(res){
$('#mydiv').attr('src', res);
}
});
Usually, the garbage collector frees the memory assigned to unused variables, or variables at the end of their scope. Here,
resis purged at the end of the callback function.This is what happens in the most common browsers, anyway. I don’t really know what happens in Adobe Air, but IIRC it uses WebKit so it should behave like Chrome and Safari…
If it doesn’t, try to explicitly trigger the garbage collector assigning
nullto unused variables:Anyway, remember that you’ve still copied the value of
resin thesrcattribute of the image, so the memory usage will still be increased. This should be obvious, anyway.