To get how much GPU memory your app is using on macOS or iOS you can use this method:
```cpp
auto vm_info = task_vm_info_data_t();
auto count = TASK_VM_INFO_COUNT;
auto kerr = task_info(mach_task_self(), TASK_VM_INFO, task_info_t(&vm_info), &count);
if (kerr == KERN_SUCCESS) {
// This seems to match GPU memory usage well. On macOS it seems the memory is released
// more lazily, so the value may be higher than actual usage.
auto memoryGpu = count >= TASK_VM_INFO_REV3_COUNT
? int64_t(vm_info.ledger_tag_graphics_footprint + vm_info.ledger_tag_graphics_footprint_compressed)
: 0;
}
```
To get how much GPU memory your app is using on macOS or iOS you can use this method:
```cpp
auto vm_info = task_vm_info_data_t();
auto count = TASK_VM_INFO_COUNT;
auto kerr = task_info(mach_task_self(), TASK_VM_INFO, task_info_t(&vm_info), &count);
if (kerr == KERN_SUCCESS) {
// This seems to match GPU memory usage well. On macOS it seems the memory is released
// more lazily, so the value may be higher than actual usage.
auto memoryGpu = count >= TASK_VM_INFO_REV3_COUNT
? int64_t(vm_info.ledger_tag_graphics_footprint + vm_info.ledger_tag_graphics_footprint_compressed)
: 0;
}
```