Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Joncom

If EntityBlobCollection contains an array of EntityBlob pointers, is this a good way to ensure the everything will be garbage-collected properly?

/* blob-collection.js */
kill: function() {
    for(var i=0; i<this.blobs.length; i++) {
        this.blobs[i].kill();
        this.blobs[i] = null; // Break pointer for garbage collector.
    }
    this.parent();
}

Mainly I&039;m talking about setting each pointer to #null. Is it necessary?

1 decade ago by Xatruch

Hi, yes freeing it will garbage collect it at some point but that can hurt the performance.

check out: http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/

1 decade ago by Joncom

Wow, that was a fantastic read on the subject.
Thank you for sharing that!

1 decade ago by vincentpiel

Yes, you have to null any reference to any object for it to be reclaimed by the garbage collector.

The article quoted by Xatruch is very interesting.

( This article is interesting also :
http://gamealchemist.wordpress.com/2013/05/04/pooling-with-init-lets-throw-impactjs-classes-in-the-pool/

:-) )

1 decade ago by Joncom

@vincentpiel: Is pooling in that article not working correctly? Screenshot

Notice how the memory usage still looks like a "saw"?

Isn't pooling supposed to turn:
/><br />
<br />
Into this? <br />
<img src=

1 decade ago by lTyl

Yes and no. Pooling does greatly help performance, but by enabling pooled objects you reduce the garbage of that particular object - but your game or application may have many hundreds more being created behind the scenes. For instance, the collision system creates garbage every call -as does ig.input. In order to get a graph like your second image, you'd have to re-write a lot of the impact libraries to be garbage-free. So you have to ask yourself, do you really need a memory graph like the second image? You should only optimize your game code in order to reach a target specification - but no further.

1 decade ago by vincentpiel

I mostly agree with Ityl.
And i did rewrite some classes to avoid GC, Input was the most greedy.
One thing i disagree though, is that yes, we need to have a flat graph. Any garbage collection does stop the game and breaks the immersion.

I really hope Impact 2.0 will be garbage-free - i mean creating only generation one garbage, of course - which is not so difficult to reach in fact, only the collision need quite some redesign to reach that goal.

1 decade ago by drhayes

100% agree with vincentpiel. Stable memory over the lifetime of the game helps in a bunch of ways with performance only being the first one.

1 decade ago by Joncom

Hmm. Interesting, the option of Impact being garbage-collector-free, right out of the box. That does sound nice.
Page 1 of 1
« first « previous next › last »