Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
out of memory

tim12345
Guest
Quote
2018-10-14 03:53:31

Hello-

Over the past few months I have been creating lots of super awesome crazy behavior scripts for my game.
I noticed a while ago that if I leave my game running for 20+ minutes.. it will eventually completely freeze, and
give me an 'out of memory' error. At first I thought it was my screensaver that was causing it, but no… it appears to happen if I have multiple behaviors running at the same time.

I was able to reproduce the error by doing the following:

First I create a simple cube in the editor that constantly moves in one direction on all 3 axis.

Then I create a second cube and attach this behavior to it:


/*
<behavior jsname="behavior_follow" description="Follow">
<property name="NodeToFollow" type="scenenode" />
</behavior>
*/
behavior_follow = function(){
}
behavior_follow.prototype.onAnimate = function(currentNode){
var cubePos=ccbGetSceneNodeProperty(this.NodeToFollow,"Position");
ccbSetSceneNodeProperty(currentNode,"Position",cubePos.x+10,cubePos.y+10,cubePos.z+10);
}


This function is extremely simple, it only has 2 active lines in it, and when attached to an object, all it does is "follow" any object that you select.

So I tell this second cube to follow the first cube.
🔎︎

Now I create a third cube, attach the same behavior, and tell it to follow the second cube. I repeat this process until I have 60 cubes.

It will then look exactly like this.

http://www.timiscool.net/cubes.h...

This appears to be working as it should in WebGl.

But if I make an .APP or .EXE version of it, it will freeze up and give me the 'out of memory' error.

With 60 cubes, it freezes up within less than 2 minutes. The more cubes add, the quicker the 'out of memory' error occurs. And the less cubes I have, the longer it takes to occur.

I guess my question is: Am i doing something wrong in my code? Or is it a bug in CopperCube? Why does it work in WebGl but not on Mac/Windows?

I appreciate any and all advice.


niko
Moderator
Quote
2018-10-15 09:31:05

Hm, difficult to tell, it could be that you have a memory leak somewhere in the code, and the browser engine can collect that while the windows exe version cannot. Can you maybe send me the .ccb so I can try and look at this?


tim12345
Guest
Quote
2018-10-15 18:30:10

as you wish, sir.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact