I have been using Papervision3D for a while, one of problems that I encountered is the memory leak while unloading the Cube with MovieMaterial. For example, building the 3d panoramic, unloading the current panoramic cube which using MovieMaterial and then create a new one will cause the memory double up, not stay at the same level, if you keep on doing that several times, you will see the browser using up to 1GB memory! Eventually you will run out of memory…

After searching the official PV3D forum, I have found several solutions that claim to solve this problems but only one solution did work for me which is adding “virtualMouse.stage = null” to destroy() method in “InteractiveSceneManager.as” in “org.papervision3d.core.utils” package with rev727 so we have the code below instead:

public function destroy():void {
	viewport = null;
	renderHitData = null;
	currentDisplayObject3D = null;
	currentMaterial = null;
	currentMouseDO3D = null;
	virtualMouse.stage = null;

	container.removeEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
	container.removeEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
	container.removeEventListener(MouseEvent.CLICK, handleMouseClick);
	container.removeEventListener(MouseEvent.DOUBLE_CLICK, handleMouseDoubleClick);
	if (container.stage)
		container.stage.removeEventListener(Event.ENTER_FRAME, handleEnterFrame);
	container = null;
}

Remember you will need to destroy other reference to the display object too and I hope the PV3D team can implement this to future version.