Memtest (memory in browser)

To an old programmer like me who used to work in 64 kB of RAM or less, the browser feels like it has almost unlimited memory. Most browsers are now running on 64 bit operating systems, and do have a lot of capacity.

We can load images in binary or less optimized Base64 encoding, and even movies.

In my previous post on File I/O I said you can store these image file contents in strings. But this raises a new question:

How much RAM is available for strings

There actually is a limit on both total memory and individual string size. In most cases, it’s the same thing.

I quickly wrote a program to find these values for some typical systems. It crashed on the despicable IE, but works safely on all modern and recommended browsers.

The exact numbers will be slightly larger than these, as there is some overhead.

OS Browser One String Total

Windows

IE (EWB IDE)

1 GB
(then crashed)

1 GB
(then crashed)

Windows

Chrome

500 MB

500 MB

Windows

Firefox

1000 MB

1000 MB

OSX

Safari

1.9 GB

1.9 GB

OSX

Chrome

500 MB

500 MB

OSX

Firefox

1 GB

1 GB

Pixel 6,
Android 14

Chrome

498 MB

498 MB

Samsung Tablet Android (ancient)

Chrome

249 MB

249 MB

iPad iOS 17

Safari

1 GB 900 MB
crashes and restarts app

1 GB 900 MB

iPad iOS 17

Chrome

1 GB 400 MB
crashes and restarts app

1 GB 400 MB

where
1 MB = 1024 kB
1 GB = 1024 MB

This gives you a good feeling that as long as you use less than about 500 MB, you should be fine on all these browsers except the ancient Android tablet.

I was surprised that the phone’s mobile browser gave a similar result, since it has less usable RAM (3GB probably for all applications combined).

I don’t know why Safari has about four times as much RAM available on the same OS as Chrome…​ or twice as much as FireFox.

Explorer and also the iPad grow very generously, but then crash. The operations are inside Try Except End loops, so no browser should crash. IE closes the application, whereas the iPad restarts the page a few times, then gives up and gives an error.

You can try it yourself here.