79

I read that it's possible to allocate either 128MB, 64MB or 32MB to the Raspberry Pi's video memory.

Given that my primary use case for this machine is educational: I will be running lightweight python scripts and web-browsing. Is it likely to suffer any loss of features by switching to only 32MB of memory for me?

I do not anticipate wanting to use any 3D or playing any video.

3
  • 2
    Make sure you adjust your swapiness :D
    – earthmeLon
    Commented Oct 26, 2012 at 18:04
  • 1
    Wait, this has 42 votes. It's not a question, it is the answer! Commented Feb 7, 2014 at 20:02
  • I believe the range of values is now wider than that, and, as per @Krysztof Adamski answer it is possible to specify a specific split in the config.txt for different total memory sizes so that the same card can produce appropriate splits when placed in different RPis - which is useful when preparing distributions I guess...
    – SlySven
    Commented Jan 20, 2016 at 9:06

3 Answers 3

60

I would expect you to not experience a noticeable difference unless you are doing graphically heavy tasks, such as playing video.

However, it's difficult to gauge the optimal settings, as performance limits will vary depending on what applications are executing and user expectations.

The best thing you can do is experiment.

If you do want to change the split, then there are two different methods, depending on the firmware you have. If possible then make sure you have the latest firmware. If it is not possible for you to update for whatever reason, then I have included both options below:

New Firmware (after October 2012)

  • Edit /boot/config.txt and add or edit the following line:

    gpu_mem=16
    
  • The value can be 16, 64, 128 or 256 and represents the amount of RAM available to the GPU.

Old Firmware (before October 2012)

In order to alter the video memory you need to replace the start.elf file on the /boot/ partition of the image. The possible .elf files should be in the /boot/ directory on your Pi. You make the switch by replacing the start.elf file with one of the others.

There are three memory models, and here are the recommendations taken from the Raspberry Pi discussion board:

  1. 224MB RAM and 32MB VRAM for a Linux desktop distro, or a heavy (non GUI) applications that don't need to play video, nor render 3D.  
  2. 192MB RAM and 64MB VRAM (default) for desktop distro's that want to play video or have 3D effects.  
  3. 128MB RAM and 128MB VRAM for applications and games that do extensive multimedia or play 3D rendered games.  

 And one more:

240MB RAM and 16 VRAM for almost zero graphical power. There is enough GPU memory to render the screen, but not much else. Use this when you need a further non GUI performance boost.

2
  • I have updated the answer for the new 512MB Models.
    – Jivings
    Commented Oct 24, 2012 at 16:33
  • Subtitles seem to increase memory needs; for a 1080p video with subtitles, 64MB was strictly not enough.
    – Raphael
    Commented Mar 27, 2013 at 7:42
53

RAM is very crucial for Linux performance for couple of reasons:

  • Caches. Linux runs without free memory for most of the time. If some memory is not used by applications, it is used for caches which speeds things up. So no memory is ever wasted. If applications needs more memory, caches are freed so caches won't ever prevent applications needing more RAM from running. But of course the more your can cache, the better.

  • Many applications (especially desktop ones) needs a lot of memory to run nowadays. This is no surprise - most desktop systems (or even smartphones) this days have a lot more memory than Rapsberry Pi. For example web browsers even lightweight) will use tens of MB of memory as soon as you open some bigger web site.

  • Each and every application needs some amount of memory. So the more applications you run, the more memory they use.

So you always want to have as much ARM memory as possible. But GPU has its own needs depending on what features you want from it.

256MB version

For older RaspberryPi, with 256 MB of RAM, 4 splits are available:

  • 240/16 - The most RAM size ARM can get (240MB) with mimial GPU memory. It's the best for general computing when you don't need 3D graphics or hardware video acceleration. It has enough memory to handle 1920x1200x16bpp framebuffer resolution. While 32bpp is also working, it's not recommended since it leaves very small amount of free memory for GPU.

  • 224/32 - This one is deprecated in favor of 240/16 split. It has 3D and hardware video decoding build in but since there is not enough memory to actually use it, there's little point in using it. Unless you have some problems with 240/16 split or want to use 32bpp framebuffer at highest resolution. It is possible it will be deleted in the future.

  • 192/64 - You need at least 64MB of GPU split to use hardware video acceleration or 3D graphics. It may not be enough GPU memory for hardware accelerated video playback at highest resolution or if you need a lot of GPU memory for things like textures.

  • 128/128 - The most RAM GPU can get. Use it when you need a lot of memory for 3D graphic card and hardware accelerated video playback in high resolution. This split is needed for RaspBMC to work properly or to play fullHD video content with omxplayer without problems.

512MB version

New versions of RaspberryPi has 512 MB of RAM. You have 4 additional splits designed for this version:

  • 496/16 and 448/64 - like 240/16 and 192/64 split for 256MB respectively but with 256MB more RAM available for ARM. Since GPU has only 16 MB/64MB or RAM, all the limitations from 240/16/192/64 still apply.
  • 384/128 - Similar to 128/128 split for 256MB - you should get all the graphic chip features but with reasonable amount of ARM memory. This will probably be the most universal split right now.
  • 256/256 - Some bonus graphic card memory if you really need it, like for big textures and similar things. While 256MB of ARM memory is bigger than you could possibly have in older RaspberryPis, I don't think this one will be used on many occasions.

Dynamic splits

New versions of firmware package removes most of start_*.elf files, leaving only start.elf and start_cd.elf (also fixup*.elf files where added). From now on, you don't have to manually choose proper start_*.file. Instead, you should use gpu_mem* options in config.txt file to choose how much memory goes to GPU. The remaining memory will be allocated to ARM. It should be possible to use arbitrary number in the following range for this options:

**512MB of RAM**: 16M-448M
**256MB of RAM**: 16M-192M

While there is no hardcoded split values right now, most of the informations for the rest of this answer should still be valid when you're trying to determine how much memory should be allocated to GPU.

start_cd.elf and fixup_cd.elf files are cutdown versions of the respective files, only used when gpu_mem=16.

Using one SD card on both 256 and 512 MB version

If you are using one SD card image for different RaspberryPi versions, you can use gpu_mem_256 and gpu_mem_512 options. First one will only be used on 256MB version while second one only on 512MB version of the board.

4
  • Yes, upgrade is worth if you want to use both XBMC and LXDE without boring manual config file change before eatch switch, or if Pi is your main computer which you want to use on a daily basis.
    – avra
    Commented Nov 22, 2012 at 13:09
  • 6
    Useful guidance. To clarify - what would be the optimal split for running headless? Does for instance the rpi camera module have a GPU requirement?
    – geotheory
    Commented Apr 20, 2014 at 14:30
  • There is now a gpu_mem_1024 for, not surprisingly the 1024 MB RPis - which currently is the RPi 2 B (and I guess A if one does come out?)
    – SlySven
    Commented Jan 20, 2016 at 9:02
  • According to elinux.org/RPiconfig#Camera , the camera module requires the following lines in /boot/config.txt: start_x=1 and gpu_mem=128 or more. Also, /usr/bin/raspi-config has an option that enables the camera.
    – mpb
    Commented Aug 13, 2016 at 22:01
2

From my experience, 8-16MB for just terminal. 20MB for 800p GUI 24MB for 1080p GUI 32MB for 1440p GUI 64MB for <1080p youtube videos 128MB for 1080p youtube videos 256MB for 4k videos (more than likely the Pi can't do 4k very well).

1
  • That's true for 3B+ and earlier, for 4B don't set a value, let the system calculate an optimal value. Do not set a value over 256MB on a 4B.
    – Dougie
    Commented Dec 21, 2019 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.