开发者

Apps is using high CPU usage than others normal webview

EDIT : Problem solved , "memory leak" was causes by one of the javascript below that keep on开发者_StackOverflow社区 running in the HTML background that the rendering is using high CPU usage:

(so if anyone can help me fix this javascript leak are welcome too.)

var cog = new Image();
function init() {
cog.src = 'data';
                setInterval(draw,10);
            }
            var rotation = 0;
            function draw(){
                var ctx = document.getElementById('text').getContext('2d');
                ctx.globalCompositeOperation = 'destination-over';
                ctx.save();
                ctx.clearRect(0,0,27,27);
                ctx.translate(13.5,13.5); 
                rotation +=1;
                ctx.rotate(rotation*Math.PI/64);
                ctx.translate(-13.5,-13.5);
                ctx.drawImage(cog,0,0);
                ctx.restore();
            }
            init();

Webview is using high CPU usage than others. Normal webview apps and the CPU usage won't drop to 0%. When I see at the Task Manager the application will highlighted in red and got killed by Android.

The CPU usage will be around 15+% to 27+%

Is it memory leak or its normal ?

Image :

Apps is using high CPU usage than others normal webview


If it was a memory leak you may see that your memory usage is grow. This situation can be explained that JS actions use many resources on this app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜