1

It seems my chrome has right now a memory limit of 4GB assigned to JS for every tab:

window.performance.memory.jsHeapSizeLimit

JavaScript memory limit

I've found here we can change that with these flags:

chromium --js-flags="--max_old_space_size=512 --max_semi_space_size=512"

Raise Chrome JS heap limit?

But I've tried running:

chrome.exe --js-flags="--max_old_space_size=8000 --max_semi_space_size=8000"

from command prompt and jsHeapSizeLimit stills returning: 3760000000

Enrique
  • 4,693
  • 5
  • 51
  • 71
  • Perhaps, it's a 32 bit process? – phuzi Jan 06 '21 at 11:50
  • Does [this](https://stackoverflow.com/questions/25389096/why-is-memory-usage-not-correctly-updated) help you? – Eldshe Jan 06 '21 at 11:51
  • 1
    It's because the max heap size is 4GB on 64 bit systems (1GB on 32 bit). You can't increase it beyond that. You can read more about that [here](https://www.xspdf.com/resolution/50805026.html). – icecub Jan 06 '21 at 11:54
  • Does this answer your question? [Max memory usage of a chrome process (tab) & how do I increase it?](https://stackoverflow.com/questions/17491022/max-memory-usage-of-a-chrome-process-tab-how-do-i-increase-it) – icecub Jan 06 '21 at 11:57
  • 1
    Also, to be fair, if a script requires more than 4GB ram, I think it's time to either re-evaluate the script or find a more suitable solution for the problem than javascript :P – icecub Jan 06 '21 at 12:01
  • @icecub I need to process a lot of data saved in json format, loading and parsing that data every time I need to process is consuming 70% of the time, but if 4GB is the limit for JS, even in NodeJS, then yes, I will probably need another language. Do you know if the limit is for chrome only or for V8 (hence NodeJS too)? – Enrique Jan 06 '21 at 12:04
  • You could have a look at web workers instead. If the data doesn't require a shared memory pool, this might be a solution for you. Otherwise you'll have to manually transfer data in memory between the workers. Which might just not be worth all the trouble. So ye, in that case, another language will probably be easier and faster. – icecub Jan 06 '21 at 12:13
  • Afaik the limit is imposed by V8 itself. Not the browser – icecub Jan 06 '21 at 12:14
  • @icecub But if the limit is from V8 then the worker will have the same limit right? and also if I have the data in the worker, is not that serialized to json and then parsed again to pass that that to the main thread? (and parsing JSON is actually the slow part in my data) – Enrique Jan 06 '21 at 12:38
  • Yes, a single worker will have the same limit. The idea I had in mind was to divide the amount of data to process amongst workers if that was possible. But if it's the processing itself and not the amount of data, then workers won't help here. I'd probably use a different language instead. Like C# maybe. Luckily you're dealing with JSON. Pretty much any language can handle that – icecub Jan 06 '21 at 12:43

0 Answers0