There are is no code creating controls manually - everything is done via data binding.
Why am I seeing this behavior? What can I do to fix it? Please help!
UPDATE: I figured out that the problem is not a memory leak. The issue here is that the listbox is creating objects to display the images of the employee and is not releasing for the garbage collector after the listboxitem gets out of the window. The CleanUpVirtualizedItem event occurs as I expected but the memory is still not released. Any ideas?
Try this: Open the task manager, go to the processes tab, go to view, select collums and check the box that says VM size. Notice that when you minimize or restore a program or application the memory changes from what's in Memory Usage to VM size.
In general, WPF is perfoming much worse in drawing performance than Windows Forms, and native GDI or DirectX. Yes, WPF is powerful in the sense you might make some neat stuff that is not supported in GDI, but it is more sluggish.
WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).
At the risk of being glib, you have a memory leak. Why not try a tool like ANTS* to track it down. They have a free trial, I've never used it but it has a good reputation.
*Other profiling tools are available.
If you don't want to get to grips with another tool, you can try something like incrementing a static member every time a class is created and decrementing it every time an instance is disposed. This will help you track down instances that are not be destroyed properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With