RSSHub-Radar icon indicating copy to clipboard operation
RSSHub-Radar copied to clipboard

扩展启动一段时间后,内存占用飙高

Open twio142 opened this issue 2 years ago • 12 comments

扩展刚启动时占用内存仅 20+ MB,但几天后会发现飙高到 400+ MB,甚至期间并没使用过扩展。

image

Chrome: 99.0 RSSHub Radar: v1.7.0

twio142 avatar Apr 25 '22 00:04 twio142

Need more debug info:

  • chrome://process-internals/#web-contents
  • chrome://extensions/?id=kefjpfngnndepjbopdmoebkipbgkggaa -> click background.html -> switch to the Console tab

Rongronggg9 avatar May 15 '22 14:05 Rongronggg9

我也遇到了这个问题

image image

另外,我安装了 workona 标签管理插件并启用了其中的休眠功能(一段时间不使用的标签页会进入休眠),不知道是否与报错有关

aur3l14no avatar Dec 16 '22 12:12 aur3l14no

image

我也有使用标签页定时休眠的插件。另外我发现每当打开新标签页(chrome://newtab)就会报错 Failed to construct 'URL': Invalid URLCannot read properties of undefined (reading 'length')

twio142 avatar Dec 16 '22 13:12 twio142

使用休眠标签导致内存异常的可以试试右键标签改了。 image

JJcdomat avatar Dec 17 '22 05:12 JJcdomat

Invalid URL errors are fixed in cf15a0a66a6da8576610f8a0331525e542435727, but I'm not sure if it caused the memory leak

DIYgod avatar Jan 15 '23 16:01 DIYgod

The leak still exists with v1.10.1... Now I’m receiving Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

twio142 avatar Jan 18 '23 13:01 twio142

image

This problem still exists.

Edge: 111.0.1661.62 x64 RSSHub Radar: 1.10.1

Chaoses-Ib avatar Apr 13 '23 14:04 Chaoses-Ib

Same issue on version v2.0.6 Chrome: 120.0.6099.109 (x86_64)

lesywix avatar Dec 27 '23 08:12 lesywix

I speculate that the memory leak in the v2 version is caused by console.debug. I have removed all console.x at here. Please observe if v2.0.7 still has any memory issues.

DIYgod avatar Dec 28 '23 15:12 DIYgod

In version 2.0.7, the memory consumption is still high, but the background service worker and offscreen.html memory usage seems to be normal. I'm unsure about the exact cause of the problem.

DIYgod avatar Dec 30 '23 03:12 DIYgod

Sharing a workaround: I remove the permission "access to all pages" so that the extension is only activated when I click on it. Seems to be smoother now.

aur3l14no avatar Jan 02 '24 05:01 aur3l14no

I further debugged and found that the memory leak may be caused by DOMParser. Then I found a stackoverflow post confirming my guess, so I removed DOMParser in this commit, hoping this will solve the problem. 653f0db98751f0ae380105c32b8d27a94b1062e0

DIYgod avatar Feb 23 '24 16:02 DIYgod