4

The question is - how much memory available to the main process in Electron?

Background:

I am building an app, which deals with large amount of table-like data, memory usage could be about 500Mb, could be more in the future.

And there is a requirement to save it as xlsx. I can build xlsx on the server (this is not an issue), but I also want to build it on the client side - and this is kind of an issue.

In chrome there is around 2Gb memory available, and for current use case it is ok - I will have to use maybe around 400Mb for xml's, maybe about 100Mb for streaming xml and zipping, and around 100Mb for final xlsx blob. In total 1100Mb.

But it is possible, that there will be more data in the future. And I will get overflow at some point in Chrome.

So I figured out, maybe in Electron app I can get access to total PC memory? Maybe someone has an answer, or point to some docs - I have not found answers yet.

If no-one knows, I'll test myself obviously...

Valery Baranov
  • 368
  • 3
  • 10
  • When the OS runs out of physical memory, it will use virtual memory. This will cause a drastic slowdown but usually works fine. –  Jan 14 '19 at 13:11
  • 1
    I find it hard to believe that your actually going to have 500Mb of data client side. What is this data?! Have you considered how your going to transmit this over the wire? If this is on GB ethernet you might be ok but if your planning on hosting this externally your going to be in trouble. What happens if 10 people click save at the same time! How is your server going to cope with 5Gb worth of HTTP traffic simultaneously. That usually called DDos attack. This all smells of an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – Liam Jan 14 '19 at 13:15
  • @Liam over the wire it takes about maybe 10-20Mb zipped. 500 Mb is memory usage in Chrome, there are a lot of strings. – Valery Baranov Jan 14 '19 at 13:16
  • 500Mb compresses to 10mb? Do you mean gzip compression or are you actually zipping it client side? Seriously what "data" is this? – Liam Jan 14 '19 at 13:17
  • @Liam data includes a lot of repetitive strings. – Valery Baranov Jan 14 '19 at 13:18
  • 1
    This is all very strange. I'm pretty sure your missing something but with the information you've posted who knows. `¯\_(ツ)_/¯` – Liam Jan 14 '19 at 13:19
  • 2
    @Liam The question is - how much memory available to the main process in Electron? – Valery Baranov Jan 14 '19 at 13:21
  • Possible duplicate of [JavaScript memory limit](https://stackoverflow.com/questions/2936782/javascript-memory-limit) – Liam Jan 14 '19 at 13:22
  • 1
    FYI electron is a Javascript library, there is nothing special about how it is dealt with by the browser, so really the question is "how much memory available to the javascript process" though it's not actually a process. – Liam Jan 14 '19 at 13:24
  • @Liam thanks, I'll check it. – Valery Baranov Jan 14 '19 at 13:25
  • 2
    If you're developing a desktop app you should be able to increase Chrome's memory limit by using the Node option `max_old_space_size` (see [How to increase the max memory limit for the app built by electron-builder?](https://stackoverflow.com/questions/43933951/how-to-increase-the-max-memory-limit-for-the-app-built-by-electron-builder)) – user2314737 Jan 14 '19 at 13:40

0 Answers0