mouseEnabled, memory increase on mousemove

Software: Away3D 4.x

Songoo, Newbie
Posted: 28 April 2012 04:20 PM   Total Posts: 5

Hello, in example below, i make about 150 simple planes, with mouseEnabled = true; i got RAM increase(in AwayStats) with mouse moving (about +1M in 3 mouse circles), can anyone help?

for (var i:int 0i<=colorarray.length-1i++) {
    
var dattt:BitmapData = new BitmapData(256256falsecolorarray[i][0]);
    var 
texturee:BitmapTexture = new BitmapTexture(dattt);
    var 
customMaterial22:TextureMaterial = new TextureMaterial(texturee);
    
customMaterial22.bothSides true
    
buttonsarray[i] = new Mesh(new PlaneGeometry(1010), customMaterial22);
    
buttonsarray[i].= -70 -  Math.floor(i/20)*12;
    
buttonsarray[i].130 - ()*12 ;
    
buttonsarray[i].rotationX 90;
    
buttonsarray[i].castsShadows  false;
    
buttonsarray[i].mouseEnabled true;
    
buttonsarray[i].mouseHitMethod MouseHitMethod.MESH_CLOSEST_HIT;
    
buttonsarray[i].addEventListener(MouseEvent3D.MOUSE_DOWNonPlaneDown,false,0,true);
    
buttonsarray[i].name "name";
    
buttonsarray[buttonsarray[i].name] i
    
buttonsplane.addChild(buttonsarray[i]);
   
   

Avatar
Matse, Sr. Member
Posted: 28 April 2012 05:17 PM   Total Posts: 149   [ # 1 ]

Did a quick test using the MouseInteraction example from github, I see memory usage going up slightly, then going back to its initial value probably when stuff gets garbage collected. In that example the code listens for mouse move / mouse over / mouse out and click though.

I’m using the beta from github, I think that’s the latest (not consiering dev branches, just the master one).

Does it keep increasing on your end and never going back down ?

   

Songoo, Newbie
Posted: 28 April 2012 06:55 PM   Total Posts: 5   [ # 2 ]

Hi Matse, tnx for response . I did more testing in firefox v.11(windows 7 32,GF9600M GT), started example (link down) , example loaded at 69.5M did a little of mouse movement till reached 90M, after half hour i checked it again it was still at 90 . Same behavior at opera (althrough at opera it starts at 124M)

I throwed array part to demo code :

MouseEnabled: false - http://songoo.ic.cz/cc/GettingStartedWithAway3D.html
MouseEnabled: true - http://songoo.ic.cz/dd/GettingStartedWithAway3D.html
(data in statistics sometime mix if i have both links opened at same time in one browser)

.as http://songoo.ic.cz/dd/q.txt , line with

buttonsarray[i].mouseEnabled true//= false; 
   

Avatar
Matse, Sr. Member
Posted: 28 April 2012 08:14 PM   Total Posts: 149   [ # 3 ]

Hi Songoo,

just tested your links, one after the other : on the mouseEnabled one I see exactly the same behavior as I was describing in my first post, except the garbage collector seems to kick in “later”. I mean I had to mouve mose to get RAM usage above 100M, I think it was 102M but maybe a bit more, then memory dropped down.

I don’t know how gagbage collection works exactly in flash player, but it could be that it kicks in after a certain percentage of the initial RAM usage has been used, which would explain why in the away demo memory drops back down sooner than in your example.

BTW not sure what you’re doing, maybe it’s just that I have other pages open that use Flash and eat memory, as nearly 90MB for a few planes reacting to mouse seem quite high ?

   

Songoo, Newbie
Posted: 29 April 2012 06:58 AM   Total Posts: 5   [ # 4 ]
Matse - 28 April 2012 08:14 PM

as nearly 90MB for a few planes reacting to mouse seem quite high ?

Well all demos i tryied starts at similiar amount.

So i did some googling:
“The garbage collector uses a set of heuristics that look at the RAM allocation and the size of the memory stack, among other things, to determine when to run. As a developer, you must accept the fact that you will have no way of knowing when, or even if, your inactive objects will get deallocated. You must also be aware that inactive objects will continue to execute indefinitely, until the garbage collector deallocates them, so your code will keep running (enterFrame events will continue), sounds will keep playing, loads will keep happening, other events will keep firing, and so on.”

Then i tried move mouse in my example longer as i used to .
On start 83M after reaching 120M it dropped to 87M , then 115->87, 114->87 .

So it seems all works great, i just didnt know how smile .

Tnx for help Matse .

   

Avatar
Matse, Sr. Member
Posted: 29 April 2012 11:32 AM   Total Posts: 149   [ # 5 ]

Well all demos i tryied starts at similiar amount.

Sorry if I sounded harsh, I didn’t intend to. However I can run plenty of demos that will eat much less thant that, starting with the mouse interaction example which takes about 15 (release build) to 22 (debug build) MB RAM for pretty much the same thing.

Just thought that was worth a “heads up”, with less tabs opened and no other flash running I still get a 75MB RAM usage on your demo, which you might care about or not as the demo might be quick and dirty stuff that you’ll do differently in a “real” project.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X