Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FLASH LoadVars (MEMORY LEAK)

Status
Not open for further replies.

MaKe81

Programmer
Apr 19, 2004
5
SI
We are working on a project where Flash application should read in a constant loop variables from php script and then

properly react.

Everything works fine execpt after a memory usage start to grow at 1Mb/min, more or less... it varies from time to time.

Our browser works then very slow (Mozilla Firefox, Opera, Mozilla Firefox and Mozilla for Linux)

Our code:

_root.onEnterFrame = function()
{
load_lv = new LoadVars();

load_lv.load("}

We also tried with function LoadVariables but we got the same results (MEMORY LEAK).

Is this a bug in a Flash or we are missing something?

Please give us some advise what to do. Is there any other possible way to read variables from php script. (10 times/sec)

We have also tested an AMFPHP example found on the and if you click on search button very

often and fast for a while you also get memory leak.

PLEASE HELP!!!
 
Try only creating the loadVars object once as the process of creating the object is processor intensive and additive (the objects aren't destroyed or replaced by the new object of the same name):

Code:
load_lv = new LoadVars();
_root.onEnterFrame = function() {
	load_lv.load("[URL unfurl="true"]http://robin56.uni-mb.si/tekma/timer.php");[/URL]
};

Also calling the script on every frame seems like overkill how about using setInterval to load the data every second instead?
 
Thank you for your answer but the memory is STILL GROWING.

If I load the data every second the memory leaking is still present but not so fast.

Help!!!
 
How about explicitly destroying the object after it's done its job?

Code:
formatData = function () {
	// do something with data then...
	delete load_lv;
};
getData = function () {
	load_lv = new LoadVars();
	load_lv.onLoad = formatData;
	load_lv.load("[URL unfurl="true"]http://robin56.uni-mb.si/tekma/timer.php");[/URL]
};
//
setInterval(getData, 1000);
//
stop();
 
Have you tried explicitly destroying the object once it has been used?

Code:
formatData = function () {
	// do something with data then...
	delete load_lv;
};
getData = function () {
	load_lv = new LoadVars();
	load_lv.onLoad = formatData;
	load_lv.load("[URL unfurl="true"]http://robin56.uni-mb.si/tekma/timer.php");[/URL]
};
//
setInterval(getData, 1000);
//
stop();
 
Thank you for your answer. Actually memory leak is a less obvious but still here (about 100KB/min) even my software do nothing. I just pasted the code you gave in first frame and that's all.

I don't get it what's wrong. This must bu a bug or something. I don't know.

We have almost finished our project but now we crashed on this serious problem which we can not solve.

:(

 
This example reads variables from php script only in Mozilla. It's a bit strange to me but ok.

So in explorer you won't get memory leak of course.

Try with firefox, opera or anything like it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top