Is there a better way of obtaining GPU memory usage than using `vcdbg reloc`? Since that requires that you flush the cache first, it's not reliable.
The vcgencmd mem_reloc_stats and mem_oom commands are useful, but it would be nice to get the usage before we run out. I notice there is a mem_test command which seems to perform some kind of test allocation. So I can't figure out how much is left by trial and error. But is it atomic? IE, will other processes fail to allocate during the test?
Or, is there some other way of getting the memory usage that I have missed? (Fine if it's an API call).
Thanks!
Re: Getting GPU memory usage
In order to get the GPU mem usage the easiest way is to use the MailBox Property Tag 0x00010006 Get VC memory.
I am not yet familiar with any other method of doing this.
I am not yet familiar with any other method of doing this.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers.
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers.
Re: Getting GPU memory usage
Thanks. This seems to be returning the total GPU memory size:
(128Mb in my case). What I would like is the amount of free memory. Have I made a mistake in how to call it?$ /opt/vc/bin/vcmailbox 0x00010006 0x10 0 0 0 0 0 0
0x0000002c 0x80000000 0x00010006 0x00000010 0x80000008 0x37000000 0x08000000 0x00000000 0x00000000 0x00000000 0x00000000
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6332
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Getting GPU memory usage
Code: Select all
vcgencmd get_mem <type>
arm: total memory assigned to arm
gpu: total memory assigned to gpu
malloc_total: total memory assigned to gpu malloc heap
malloc: free gpu memory in malloc heap
reloc_total: total memory assigned to gpu relocatable heap
reloc: free gpu memory in relocatable heap
Re: Getting GPU memory usage
Thanks! That's exactly what I was looking for.