Scroll Viewers as master of Video Memory management

129 views Asked by At

I dont know how many of you have observed this, when we minimize a complex WPF application we can observe reduction in used memory. Also when we restore the WPF window, it regains that memory.

My question is this

  1. Is this what we call video memory?
  2. Do we observe the same thing in WinForms apps too? I am asking this because I saw MSWord not doing anything like that when I minimized it.
  3. Also if windows OS manages this memory so well, then why didnt we virtualize everything i.e. instead of making virtualized stack panels, why wouldn't we make scroll viewers the master of UI virtualization?

I hope I get some interesting answers on this.

1

There are 1 answers

0
Kieren Johnstone On

Video Memory is something completely different. It is used by a graphics card to store textures, screen imagery, shader program input/output, etc.

WPF uses more video memory because it uses graphics acceleration, textures, shaders and offscreen surfaces.

WinForms apps do not - they only render using GDI and as such unless something is happening off-screen by design, far less video memory is used.

Finally, you cannot measure video memory without using a dedicated tool. Any memory you see when restoring/minimizing windows etc in Task Manager is not video memory, but 'regular' memory. Actually you might see main system memory used for video memory in an extremely low-end system, but more likely WPF doesn't need to keep as many things current in the event the window is minimized, so some objects are released.

As such, I don't understand what you mean by, 'if Windows OS manages this memory so well' - virtualisation might be good at some things, but of course has its numerous downsides, especially with WPF, which is why you wouldn't use it everywhere.