Memory leak in LoadVars?


hi,

in 1 of our apps, we've need continuously load new data (using loadvars) every x seconds server. however, seem having memory leak issue when doing same. consider following skeletal code:

var myvars:loadvars = new loadvars();
myvars.onhttpstatus = function(httpstatus) {
this.httpstatus = httpstatus;
};
myvars.onload = function(success:boolean){
//trace("data loaded: " + success);
}
var int:number = setinterval(loaddata,2000);
function loaddata(){
myvars.load(" http://server/realtime/isv3.asp?upperlimit=100&lowerlimit=0");
}
stop();

here, i'm loading data asp page every 2 seconds in same loadvars object. now, when run movie continuosly few hours, there's huge increase in memory usage of movie. using profiler, i've made sure memory increasing flash movie , not inetinfo or other process/thread.

now, here not have else in movie (no visuals, no calculations etc.) , more on we're re-using same loadvars object reload data. pointers doing wrong? appreciated.

you might try setting 2 loadvars , using sendandload. ,
also have no guarantee call has finished before trying again.
you use simple boolean call asp after prior call has
finished.

var mysender:loadvars = new loadvars();
var myreceiver:loadvars = new loadvars();
var doneloading = true;

mysender.onhttpstatus = function(httpstatus) {
this.httpstatus = httpstatus;
};

myreceiver.onload = function(success:boolean){
doneloading = true;
//trace("data loaded: " + success);
}

function loaddata(){
if(doneloading){
doneloading = false;
mysender.upperlimit = 100;
mysender.lowerlimit = 0;
mysender.sendandload(" http://server/realtime/isv3.asp", myreceiver);
}
}

var int:number = setinterval(loaddata, 2000);

stop();



--
dave -
head developer
http://www.blurredistinction.com
adobe community expert
http://www.adobe.com/communities/experts/




More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums