Garbage Collector Enigma

3 posts

Flag Post

Hi there,

I’ve read a few stuff about garbage collector. If it’s now clear for me that every event listeners added somewhere has to be removed elsewhere, it’s not as clear for objects : should I set any object I don’t need anymore on “null” ? Or maybe the object is automatically removed after a while if it has no references left ?

I try to prevent my games from lags and memory leak but it’s tricky. It would be nice if you guys would like to share your habits about optimization.

Thanks for reading

Flag Post

Check this out, might answer all your questions.

Flag Post

Thanks you, it was very helpful.