I am facing the following issue if I kept a run on a application that runs on a browser running WebGL : "Rats, WebGL hit a snag!" . I am already clearing the textures, framebuffers, programs, buffers and making canvas height and width to 1.
Here's what I am doing :
`
var gl = this.gl;
if(!gl) {
return;
}
//delete program
gl.deleteProgram(this.program);
var numTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
for (var unit = 0; unit < numTextureUnits; ++unit) {
gl.activeTexture(gl.TEXTURE0 + unit);
gl.bindTexture(gl.TEXTURE_2D, null);
gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
}
gl.bindBuffer(gl.ARRAY_BUFFER, null);
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.deleteTexture(this.texture);
gl.deleteTexture(this.textures[0]);
gl.deleteTexture(this.textures[1]);
gl.deleteFramebuffer(this.framebuffers[0]);
gl.deleteFramebuffer(this.framebuffers[1]);
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW);
gl.deleteBuffer(this.vertexBuffer);
gl.bindBuffer(gl.ARRAY_BUFFER, this.textureBuffer);
gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW);
gl.deleteBuffer(this.textureBuffer);
var buf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
var numAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
for (var attrib = 0; attrib < numAttributes; ++attrib) {
gl.vertexAttribPointer(attrib, 1, gl.FLOAT, false, 0, 0);
}
gl.canvas.width = 1;
gl.canvas.height = 1;
gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT)`
Steps to reproduce : 1)Open google chrome
2)Run the app(can't give link as it is not yet hosted , apologies!!! :( )
3)Open Chrome task manager and check GPU memory, what I see is it increases drastically as I keep adding new image after clearing and deleting the canvas and adding a new canvas and new context.
Another strange issue/observation is the GPU Memory goes until 25 GB but my GPU has a memory of 2GB only