12

I don't know if it is a critical issue or not. But, I need to get rid of the question marks in my mind.

I recently purchased a Raspberry Pi 3 board and while I was playing with it, I realized that meminfo shows the physical memory size much less(~880MB) than 1GB (which is specified on the official site).

root@mypi:~# cat /proc/meminfo 
MemTotal:         882780 kB
MemFree:          536068 kB
MemAvailable:     712180 kB

The amount of memory available to GPU is 16MB (which is the minimum allowed limit) checked twice on the related raspi-config menu item.

raspi-config -> Advanced Options -> Memory Split

Boot configuration also says that gpu_mem is 16MB.

root@mypi:~# cat /boot/config.txt | grep -i gpu
gpu_mem=16

For narrowing the problem space, here is the system info. By the way, system is up-to-date.

OS release:

root@mypi:~# cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"

Kernel version:

root@mypi:~# uname -a
Linux mypi 4.4.23-v7+ #913 SMP Tue Oct 4 14:16:19 BST 2016 armv7l GNU/Linux

Kernel vmsplit configuration:

root@mypi:~# zcat /proc/config.gz | grep CONFIG_VMSPLIT | grep -v ^#
CONFIG_VMSPLIT_2G=y

So, I have 2 questions:

  • Where is the missing 128MB memory?
  • What causes this situation?
vaha
  • 1,290
  • 2
  • 11
  • 20

3 Answers3

14

If the output of vcgencmd get_mem arm && vcgencmd get_mem gpu is

arm=880M
gpu=128M

This means that GPU is using 128M.

This can be verified/changed in raspi-config Advanced Options, although I have not reduced the GPU myself. I am going from memory, but I think this is the default, possibly related to Camera. At least you now know where your memory is.

Milliways
  • 62,573
  • 32
  • 113
  • 225
10

First of all, I give my best regards to @Milliways for suggesting to check 2 simple commands.

vcgencmd get_mem arm && vcgencmd get_mem gpu

Where is the missing 128MB memory?

Even if both raspi-config and /boot/config.txt says that the amount of memory available to GPU is 16MB, actual values are 880MB for CPU, 128MB for GPU.

root@mypi:~# vcgencmd get_mem arm && vcgencmd get_mem gpu
arm=880M
gpu=128M

So, missing (actually not missing) 128MB memory is reserved for GPU.

What causes this situation?

Even /boot/config.txt includes the line gpu_mem=16, there is another line which enables the camera module.

root@mypi:~# cat /boot/config.txt | grep -i start_x
start_x=1

So, enabling camera module leads to 128MB memory reservation for GPU which is implicitly implied here.

In short, we can say that start_x=1 overrides gpu_mem=16.

After disabling the camera module by start_x=0, here is the memory values:

root@mypi:~# vcgencmd get_mem arm && vcgencmd get_mem gpu
arm=992M
gpu=16M
vaha
  • 1,290
  • 2
  • 11
  • 20
-1

Aside from the rpi-update option, there seems to another (possible) reason why the reported memory is less. This time its to do with the kernel space / user space memory splits. This post details the fix which involves tweaking the kernel build configuration and rebuilding it from the source code. One user reported success

by tesla01 » Thu Feb 05, 2015 8:04 pm Hi, I confirm that the 2G/2G option works when use custom kernel

Feb 5 19:17:12 raspberrypi kernel: [ 0.000000] Memory: 940776K/966656K available (5785K kernel code, 377K rwdata, 1760K rodata, 396K init, 771K bss, 25880K reserved)

Thanks :)

You will need to verify this is indeed the cause (by checking the value of CONFIG_VMSPLIT is either CONFIG_VMSPLIT=3G or CONFIG_VMSPLIT=2G) as some posts further down in that link report success like so

by birdman » Thu Feb 12, 2015 10:01 pm Just this minute had an update to libraspberrypi-* and raspberrypi-bootloader. kernel now 3.18.7-v7+. memory now reported by top as "KiB Mem: 998096"

Thanks!!

while some others didnt have the same results

Unfortunately I am not near my PI to verify any of these claims.

Shreyas Murali
  • 2,446
  • 1
  • 16
  • 23