Chromium browser: exceed data ulimit

  1. Why does chromium have different limits than all other programs?

Chromium may look like a simple application but it is not, first there is the multi-threading which makes chromium run multiple process for different tasks (extensions, tab, core web-engine, etc) then the virtualisation, chromium use many sandbox to isolate the browsing activities which make it use more ressources than other application, also the used web-engine is not a light one... add to that the different needed libraries that are required to run and other heavy ressources functions... some related documentations are available here, here and this article have some useful infos.

  1. Where do the "default" limits come from (where does chromium take the limit 4294967296 from?

4294967296 bytes (4096 MB, or 4GB limit) chromium have by design a 4GB limit this is hard coded, more infos about this is available here and here

  1. How can I change these default limits once and for all, globally, for all processes regardless whether they use pam or not?

Not an easy task but you are doing it right for most usual process, now for complicated process like chromium you need to customize your config for each "special" app.

For chromium there are some command parameters that can be used to customise/enable/disable features, you can try to use some of them to make chromium suit your needs, here are some interesting switch:

Those switch can be used with a command line like this /usr/bin/chromium --single-process

--single-process
--aggressive-tab-discard
--aggressive-cache-discard
--ui-compositor-memory-limit-when-visible-mb
--disk-cache-dir  # Use a specific disk cache location, rather than one derived from the UserDatadir.
--disk-cache-size  # Forces the maximum disk space to be used by the disk cache, in bytes.
--force-gpu-mem-available-mb  # Sets the total amount of memory that may be allocated for GPU resources
--gpu-program-cache-size-kb  # Sets the maximum size of the in-memory gpu program cache, in kb
--mem-pressure-system-reserved-kb  # Some platforms typically have very little 'free' memory, but plenty is available in buffers+cached. For such platforms, configure this amount as the portion of buffers+cached memory that should be treated as unavailable. If this switch is not used, a simple pressure heuristic based purely on free memory will be used.
--renderer-process-limit  # Overrides the default/calculated limit to the number of renderer processes. Very high values for this setting can lead to high memory/resource usage or instability.

You can also run chromium with a script that update the ulimit for it (note that values lower than 4GB may crash the browser...)

ulimit -Sv 4352000000 #4.2GB
/usr/bin/chromium

# or 0.42GB, it works but the browser may crash
#ulimit -Sv 435200000 #0.42GB
#/usr/bin/chromium

On a modern 64bit system there is no sane reason to limit VM space.

VM space is used for anything memory mapped, not just physical memory. The most common usage of exhorberant amounts of VM data in current computing is sparse buffers, where a file or database that has only a fraction of it in physical memory, has the entire thing in virtual memory, with a routine to load it transparently as needed.

You want to limit PHYSICAL data memory use, and even there you should use the settings in /sys and/or /proc/sys to do so, not ulimit, as this properly signals the program that it's low on memory instead of just faulting.

Honestly, ulimit is a dirty old hack that really isn't much good for anything except for preventing denial of service attacks on a multiuser system.

Tags:

Ulimit

Chrome