better three.js object deallocation

Code taken from [Three.js example](https://github.com/mrdoob/three.js/blob/master/examples/webgl_test_memory.html#L90-91).