scene.environment or memory

after load Gltf, I add a texture to scene environment.

function sceneEnvironment(path: string) {
	const textureLoader = path.endsWith(".exr") ? new EXRLoader() : new THREE.TextureLoader();
	if (!scene) return;
	const text = track(
		textureLoader.load(path, (tex) => {
			tex.mapping = THREE.EquirectangularReflectionMapping;
	scene.environment = track(text);

Before leave this page, I dispose everything, but in only left one texture.

If i don’t use tex.mapping = THREE.EquirectangularReflectionMapping, there is no texture leave.
i don’t know how to resolve these shaderMaterial made by webgl.
can anyone help me?

Iirc setting that mapping creates a PMREMGenerator when initialising the texture the first time - which the automatically remaps the texture from planar into spherical coords.

That generator most likely creates and caches a single RT to do the mapping. Could you check if there’s more textures left in memory, if more than one texture is mapped to equirectangular coordinates? If there’s more textures stuck on memory - it’d be good to report a memory leak, most likely forgetting to dispose the texture RT after remapping the texture. But if there’s only one texture stuck, it’s most likely just cached for the future, to avoid recreating the RT and the generator everytime a mapping is changed.

I only used the texture once: texture.mapping = THREE.EquirectangularReflectionMapping; . I’m not sure if using other textures in the same way would cause the same issue. If possible, I would like to know how to eliminate the automatically created PMREMGenerator.