View Full Version : Query used VRAM

05-26-2009, 02:23 PM

i am looking for a wya to query
the currently used vram.
It is possible ot query the total
vram using kIOFBMemorySizeKey, but
is there any way to get the actual
used/free vram? ( Like the driver monitor does? )


05-26-2009, 04:45 PM
Yes, but only if you can use GL_ATI_meminfo

another method is to create a bunch of textures and fill the ram until you get an error, that would give you an aproximate clue on how much is left.

05-27-2009, 02:07 AM
Better than waiting for an error, render small textured quads, and watch the fps : When it goes to less than 5 fps, you can assume textures no longer fits all in GPU ram, but some are pulled from host memory.

05-27-2009, 08:47 PM
You can access these kinds of statistics using the IOKit API.
Search for a device of class IOFramebuffer.
Then the IOAccelTypes property will give you the ACPI path to the corresponding
IOAccelerator driver.
This driver has a PerformanceStatistics dictionary which contains the
information your looking for.

You can take a look at this dictionary using the IORegistryExplorer application
searching for "display" devices in the IOService plane.

05-28-2009, 11:58 AM
Actually, you want "accelerator" in IORegistryExplorer, not "display".

You can use IOKit to query "vramUsed" use and other statistics just like driver monitor, but keep in mind those are per-driver stats, not per-app. You're seeing a view of the entire system, with all applications simultaneously competing for the same VRAM.