Skip to content

Memory leak with Canvas and streaming video #922

@ronsykes

Description

@ronsykes

Using Chrome 16.

First, I create a texture object from a canvas that is loaded from a MJPEG stream and store it into a custom object within a function that I call every 1/3 of a second. I am constantly refreshing my canvas with a streaming video.

var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var texture =  new THREE.Texture(canvas);
streamObject.texture = texture;

Then, I execute another function to display that texture by retrieving it from the custom object and setting the material's map to that texture before I call my render function.

vCam.material.map = textureTemp;
render(vCam);

The problem however is that my memory climbs through the roof If I do not force a garbage collection with:

                try {
            window.gc();
                } catch(e) {
                    console.log("Garbage Collection is not available for this browser type.");
                }

I would like to avoid forcing the garbage collection.
Is it possible that the texture objects are not being gc'd creating my memory to climb?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions