How to monitor video card memory

Started by
3 comments, last by Chris_F 9 years, 9 months ago

How can I see the contents and allocations of my video card memory, either in real time or in Pix or any other (free) diag program? How can I poll the available video memory from a program before making allocations? What is the best way to fine tune allocations to video memory? I just realized that allocating beyond the available memory seems to crash the computer with no warning. How do I avoid this while still taking advantage of the full available memory? I'm using XNA at the moment but am porting to Sharp DX.

Thanks

Advertisement

I don't think it is possible to monitor all memory allocations and their locations for video memory. On modern architectures the GPU memory is virtualized, meaning that more than one process will have GPU memory allocated at any given time (including Windows itself). I believe the switch to DX10+ will help you in this situation, since DX9 was not a virtualized memory model.

What you can do is to monitor your own memory allocations. Anywhere that you allocate an object that resides in video memory, you can track it and keep a record of how much memory you have consumed. Then this can be compared with the physical video memory of the system, which can be acquired through DXGI interfaces.

May I ask how you found out that the crash was caused by allocating too much memory?

AFAIK, nothing you can do in a normal user space process or in/with XNA/DirectX should be able to crash the system, only your own program. In CUDA, with messed up pointer arithmetic, you can crash the display driver, but HLSL doesn't expose any pointers.

Can you build a minimal working (== system crashing) example program?

In general there is usually no need for the fine-grain video memory query that you required. The api you are using should provide some facility to report out of memory exceptions. As long as you check for these and act according, you should be able to accomplish your said goal. I know is more reactive than proactive, hope that helps.


AFAIK, nothing you can do in a normal user space process or in/with XNA/DirectX should be able to crash the system

Assuming some sort of ideal driver free from bugs.

This topic is closed to new replies.

Advertisement