How do I switch scene, clear up memory, and keep only the renderer scene and camera?

cleanup
switch-scene
#1

I have multiple threejs pages and I want them to share a single renderer camera and scene.
Every time I switch pages, I delete all the objects except the renderer camera and scene.
But I don’t know what to do.
If you can delete all the objects except renderer and scene at one time, and clean up the memory can also be.
Thanks advance:)

#2

You can traverse through the scene, remove all objects and dispose the respective geometries, material and textures. Example code for this looks like so: