i am getting memory leak issue on getImageData()[api provided by javascript] when using in a loop for fething the data from canvas in Window 7's chrome browser, it increase chrome memory on each travel on getImageData() api, so after some time when default chrome memory full its being crased.if any one know any workarround of this please suggest.
used code:
this.surface.drawImage(this.st1, 0, 0, this.canvas.width, this.canvas.height);
var data = this.surface.getImageData(0,0, this.canvas.width,
this.canvas.height);
this.timer = setTimeout(this.paint, 500);
this
belongs toowner
of the method on which it is called.
In setTimeout
, this
belongs to window as setTimeout
is method of window
=> window.setTimeout
Use
.bind()
Try this:
this.surface.drawImage(this.st1, 0, 0, this.canvas.width, this.canvas.height); var data = this.surface.getImageData(0,0, this.canvas.width, this.canvas.height); this.timer = setTimeout(paint.bind(this), 500);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.