开发者

Memory leak in chrome.extension.sendRequest()

开发者 https://www.devze.com 2023-02-01 11:47 出处:网络
Chrome Version: 9.0.597.19 (Build 68937) beta & current stable I have simplified my code as far as possible. I ended up with the attached extension:

Chrome Version : 9.0.597.19 (Build 68937) beta & current stable

I have simplified my code as far as possible. I ended up with the attached extension:

content.开发者_如何学编程js (content script run on every site):
setInterval(function() {
 chrome.extension.sendRequest({ }, function(response) {
  //Do nothing
 });
}, 1);

background.js (background page script):
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
 sendResponse({ });
});

When you install this extension, you can observe it eating up memory extremely fast (I got 90MB in 1 min with 9 tabs opened). You can speed up the process by opening more tabs.

Of course, the extension I am actually developing does not send requests every millisecond, but only every 3 seconds. This just slows it down, though. A user who has run it in the background for a long time with many tabs opened has reported 100MB of memory usage, and I can reproduce it to a less extreme extent, too.


I do not see a question so maybe answering is not relevant but,

In order to progress from this point you should do 3 things:
1. Test it on the latest chromium version. (Can be downloaded - here)
2. Check the issues list here.
3. If it has not been reported, report an issue at the left hand corner (new issue) on the link in step 2.

Good luck,
Be happy, Julian

0

精彩评论

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