Chrome进程(选项卡)的最大内存使用量以及如何增加它?

mit*_*llt 28 memory ssl https google-chrome http

嗨我在一个选项卡上通过chrome运行几千个https客户端,我似乎在浏览器中达到了限制,当我检查任务管理器时,该选项卡的chrome进程使用了​​高达897MB,所以我假设有某种限制(900MB~).

周围是否有任何镀铬向导可以解释这一点,因为我无法在网上找到任何东西,如果我可以增加最大限制,那么这将是理想的,因此我可以通过单个选项卡运行更多客户端.

谢谢!

Mih*_*scu 21

默认情况下,v8在32位系统上的内存限制为512MB,在64位系统上的内存限制为1.4GB.通过--max_old_space_size在32位上设置为最大1024(1 GB)和在64位上设置为4096(4GB),可以提高限制.您应该能够在Linux中从shell启动Chrome时设置此参数,或者作为Windows中快捷路径的参数.

  • 你实际上必须使用`--js-flags`选项将标志传递给V8引擎:`open/Applications/Google\Chrome.app --args --js-flags =" - max_old_space_size = 8192"` (7认同)
  • @Stefan true 对 x64 的限制已经过时了。根据https://github.com/v8/v8/blob/0cad8a53c8aa7d072419a42c3d26745386210ef9/src/flags/flag-definitions.h#L929中定义的标志,`max_old_space_size`现在默认为0。我测试了默认节点v12.20.0安装后无法分配大约 2GB 的空间。顺便说一句,我只是指每个选项卡/v8 进程的最大内存,而不是所有选项卡的总使用量,即“window.performance.memory”的输出。 (2认同)
  • 在 Windows 上,这是 `chrome.exe --js-flags="--max_old_space_size=1024"`。 (2认同)

Ale*_*xei 8

基于Mihai Tomescu的答案和其他资源的汇总答案:

  1. 根据这个答案,运行x64 Windows操作系统时,每个选项卡的最大内存似乎约为1.8GB

  2. 通过将Chrome链接地址从"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 更改为",可以增加标签内存"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --max_old_space_size=4096

可以使用这个巨大的图像快速测试差异,这会使Chrome默认内存设置崩溃(Google Chrome在尝试显示此网页时内存不足),但在增加内存限制后会恢复正常.

  • 以下是如何使用不同的用户添加标志 ```--profile-directory="Profile 7"``` 打开 chrome,您可以通过转到 ```chrome://version``` 来获取配置文件目录找到 **配置文件路径** 代码 `"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --max_old_space_size=4096 --profile-directory="Profile 7"` (2认同)
  • “巨大的图像”有什么变化吗?我只是打开了,没有增加内存。 (2认同)

Lau*_*det 8

看来 --max_old_space_size 不再起作用了。我在 Ubuntu 22.04(版本 106.0.5249.119)上进行了测试,它什么也没做,我在 Google 支持上发现了这个线程,说它已在 Chrome 104 中删除。

在 Ubuntu 23.04 上,它仍然无法工作,但至少在我的笔记本电脑上,限制似乎高于 4Gio。

以下是您自己检查的方法:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="Author" content="Laurent LYAUDET">
  <meta name="Publisher" content="Laurent LYAUDET">
  <meta name="Description"
    content="Check if Chrome still limits tab memory">
  <meta name="Keywords"
    content="debug Chrome">
  <title>All your memory are belong to us! XD</title>
</head>
<body>
  <h1>Check if Chrome still limits tab memory</h1>
  <p>
  Step 1: Open Chrome with command line in incognito mode
  to avoid messing with your profile (adapt this line to your OS):
  <pre>
  /usr/bin/google-chrome-stable --incognito --max_old_space_size=4096
  </pre>
  </p>
  <p>
  Step 2: Open Chrome Task Manager to check your memory (Menu > More Tools > Task manager)
  </p>
  <p>
  Step 3: Look at how much RAM used it crashes.
  </p>
  <p>
  Step 4: Repeat from step 1 with --max_old_space_size=1024.
  Currently "Version 112.0.5615.165 (Build officiel) (64 bits)",
  max_old_space_size seems to do nothing.
  Webpage loads fine with both if fine_tune_me = 400000.
  Webpage crashes with both if fine_tune_me = 1000000.
  </p>
  <script>
  // let fine_tune_me = 400000; // This value should be ok if you have enough RAM.
  let fine_tune_me = 1000000; // This value should crash.
  document.addEventListener("DOMContentLoaded", function () {
    for(let i = 0; i < fine_tune_me; ++i){
      let myTextArea = document.createElement("textarea");
      myTextArea.textContent = "All your memory are belong to us!";
      document.body.appendChild(myTextArea);
    }  
  });
  </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)