My application has very long lifespan and I want to use static memory to keep it run smoothly.
Since it’s not a game application, I have no idea how to do the object pooling. All I can think of is keeping variables busy by refer them to something.
How could I do that?
The codes below gets GC every roughly 50s. I want it to live longer or no GC at all:
var video = document.createElement('video')
, canvas = document.getElementById('canvas')
, ctx = canvas.getContext('2d')
;
window.addEventListener('load', function() {
video.src = 'my_video.ogg';
video.play();
playVideo(video);
});
var playVideo = function(video) {
this.video = video;
(function paintCanvas(video) {
window.webkitRequestAnimationFrame(paintCanvas);
ctx.drawImage(this.video, 0, 0, canvas.width, canvas.height);
})();
}
Thank you,