metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
https://zzz.dog
10.36k stars 393 forks source link

scene = new Zdog.Anchor() - Memory Leak? #107

Closed multiplayer-shop closed 2 years ago

multiplayer-shop commented 3 years ago

Hello, Here is my pseudo code:

var scene scene = new Zdog.Anchor();

I do this over and over again when I want to recreate the scene: scene = new Zdog.Anchor();

I don't remove all the old shapes I just wipe it all out by resetting the scene variable. It all works fine but I'm wondering if this creates a memory leak by not specifically removing all the shapes. (I would rather not)

Thanks

desandro commented 2 years ago

Hmm, I believe the old shapes will be garbage collected, as they are no longer 'in use' though the old scene. It would be same thing as overwriting a big object with another big object.