Reputation: 1012
I am running several thousand https clients through chrome on one tab, I seem to be hitting a limit in the browser, when I check task manager the chrome process for that tab is using a whopping 897MB so I am assuming there is some sort of limit (900MB~).
Are there any chrome wizards around that could explain this? Also it would be ideal if I could increase the max limit so I am able to run more clients through a single tab.
Upvotes: 60
Views: 180660
Reputation: 938
It seems --max_old_space_size does not work anymore. I tested on Ubuntu 22.04 (Version 106.0.5249.119) where it did nothing, and I found this thread on Google Support saying it was removed in Chrome 104.
On Ubuntu 23.04, it still does not work but the limit seems to be above 4Gio at least on my laptop.
Here is how to check it for yourself:
<!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>
Upvotes: 8
Reputation: 12490
I don't believe electron has a hard limit of 4gb. That may be its default, but I've been able to get to 16gb by doing the following in main.js:
const { app } = require('electron'); app.commandLine.appendSwitch('js-flags', '--max-old-space-size=16384');
Unfortunately no such switch exists for the Chrome browser.
Reference:
Upvotes: 2
Reputation: 23078
Aggregated answer based on Mihai Tomescu's answer and other resources:
Maximum memory per tab seems to be about 1.8GB when running a x64 Windows OS, according to this answer
Increasing tab memory works fine by changing Chrome link address from "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
" to "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --max_old_space_size=4096
The difference can be quickly tested using this huge image which will crash Chrome using default memory settings (Google Chrome ran out of memory while trying to display this webpage), but will render fine after increasing the memory limit.
Upvotes: 19
Reputation: 1597
By default v8 has a memory limit of 512MB on 32-bit systems, and 1.4GB on 64-bit systems. The limit can be raised by setting --max_old_space_size
to a maximum of 1024 (1 GB) on 32-bit and 4096 (4GB) on 64-bit. You should be able to set this parameter when launching Chrome from a shell in Linux, or as an argument to the shortcut path in Windows.
Upvotes: 42