# Texture VRAM consumption

**URL:** <https://forum.playcanvas.com/t/texture-vram-consumption/10843>\
**Category:** Help & Support\
**Created:** [September 4, 2019, 8:14pm UTC](https://forum.playcanvas.com/t/texture-vram-consumption/10843 "2019-09-04T20:14:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Locatelli\_Tade](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/diego_locatelli_tade/32/5888_2.png) [@Diego\_Locatelli\_Tade](https://forum.playcanvas.com/u/Diego_Locatelli_Tade)\
**Post date:** [September 4, 2019, 8:14pm UTC](https://forum.playcanvas.com/t/texture-vram-consumption/10843/1 "2019-09-04T20:14:00Z")

</div>

Hi guys, how it´s going?

I’m working on a project that I make a lot of changes textures from materials.  
So after some changes my vram consumption is too high (something like \> 4gb).  
I tried destroy the ‘old’ texture before put the new one, but it’s not going as I expected.

Anyone had same issue or have any idea how to proceed? thanks!!!

Part of the code I make the changes:

```javascript
ChangeMaterial.prototype.changeMaterial = function (mesh){        
    //Verify if can change the mesh material change
    if (this.allowChange(mesh.node.name)){    
        
        //New textures
        var selectedMaterial = pc.app.root.findByName('Cameras').script.cameraManager.selectedMaterial;            
        
        if (selectedMaterial !== undefined){        
                        
            //Clone the material to keep some properties, and create a new reference (I intend)
            var material = mesh.material.clone();
                                   
            if (material.diffuseMap){
                var tx = material.diffuseMap;
                material.diffuseMap = null;
                material.update();
                //destroy de current map (texture)
                tx.destroy();
            }
            
            //put the new map (texture)
            material.diffuseMap = selectedMaterial.DiffuseMap;
            
            material.bumpness = 0.25;            
            material.normalMap = selectedMaterial.NormalMap;
                                                
            if (selectedMaterial.Brilho < 80){
                //material.specular = pc.Color(0.162015503875969, 0.162015503875969, 0.162015503875969, 1);
                 material.specular =this.darkColor;
            }
            else{
                //material.specular = pc.Color(0.3803921568627451, 0.3803921568627451, 0.3803921568627451, 1); 
                material.specular = this.brigthColor;
            }            
            material.specularTint = true;
            
            material.specularMap = selectedMaterial.SpecularMap;
            
            material.shininess = selectedMaterial.Brilho;
                                
            material.update();            
            mesh.material = material;                                                  
            
        }
        
    }
};

```

---

<div class="post-metadata">

**Author:** ![Diogo\_Barros](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/diogo_barros/32/5872_2.png) [@Diogo\_Barros](https://forum.playcanvas.com/u/Diogo_Barros)\
**Post date:** [September 5, 2019, 5:41pm UTC](https://forum.playcanvas.com/t/texture-vram-consumption/10843/2 "2019-09-05T17:41:49Z")

</div>

I want to know that as well
