Click here to Skip to main content
14,335,049 members

Silverlight / WPF

 
GeneralRe: WPF memory leak BitmapImage Pin
Leif Simon Goodwin22-Feb-18 5:31
memberLeif Simon Goodwin22-Feb-18 5:31 
GeneralRe: WPF memory leak BitmapImage Pin
MadMyche22-Feb-18 8:31
mveMadMyche22-Feb-18 8:31 
GeneralRe: WPF memory leak BitmapImage Pin
Leif Simon Goodwin23-Feb-18 2:36
memberLeif Simon Goodwin23-Feb-18 2:36 
AnswerRe: WPF memory leak BitmapImage Pin
Gerry Schmitz22-Feb-18 4:46
mveGerry Schmitz22-Feb-18 4:46 
GeneralRe: WPF memory leak BitmapImage Pin
Leif Simon Goodwin22-Feb-18 5:29
memberLeif Simon Goodwin22-Feb-18 5:29 
GeneralRe: WPF memory leak BitmapImage Pin
Gerry Schmitz22-Feb-18 5:54
mveGerry Schmitz22-Feb-18 5:54 
GeneralRe: WPF memory leak BitmapImage Pin
Leif Simon Goodwin22-Feb-18 23:57
memberLeif Simon Goodwin22-Feb-18 23:57 
AnswerRe: WPF memory leak BitmapImage Pin
Leif Simon Goodwin8-Mar-18 22:35
memberLeif Simon Goodwin8-Mar-18 22:35 
Thank you to everyone for your thoughts. It appears to be unrelated to the version of .Net.

I found the source for MemoryStream and the Dispose method does NOT set the buffer reference to null. I tried assigning a static buffer to the MemoryStream instance instead of allowing it to allocate its own buffer but that caused a crash.

I created test WPF and WinForms apps and the results are bizarre.

We have a small C# class - VideoOCRWrapper - which drives an attached OCR document scanner. It essentially makes calls to a C++ DLL, and has a callback which receives a IntPtr containing a HWND. On receipt of a bitmap, it converts it to a BitmapImage and fires an event to provide a client with the BitmapImage isntance.

I created a WinForms app, which initialises VideoOCRWrapper and displays the received bitmap. It has converts the BitmapImage to a Bitmap for display.It shows no memory leaks.

I created a WPF app, which initialises VideoOCRWrapper and displays the received bitmap. It shows a huge memory leak consistent with the bitmap buffer leaking.

The two apps use almost the same code, except that the WinForms overrides the form's WndProc, whereas the WPF app hooks its own WndProc onto the main window.

I memory profiled the WPF test app, and it said that "22 types have instances that are queued for finalization. This can indicate that a Finalizer method is stuck, which will prevent instances from being finalized and cause memory leaks.".

There is an extra factor. We use a third party DLL for document verification, which receives bitmaps from us. If I remove that DLL, our code shows no leaks. If I add that DLL, we have leaks but only when running our WPF test app, or our WPF application. When running the WinForms test app, we have no leaks.
Question"Cylinder lens" scrollbar Pin
Member 798912219-Feb-18 3:33
memberMember 798912219-Feb-18 3:33 
AnswerRe: "Cylinder lens" scrollbar Pin
Gerry Schmitz19-Feb-18 6:53
mveGerry Schmitz19-Feb-18 6:53 
GeneralRe: "Cylinder lens" scrollbar Pin
Member 798912219-Feb-18 22:18
memberMember 798912219-Feb-18 22:18 
QuestionPassing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Dwayne Barsotta27-Jan-18 6:05
memberDwayne Barsotta27-Jan-18 6:05 
AnswerRe: Passing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Gerry Schmitz27-Jan-18 12:10
mveGerry Schmitz27-Jan-18 12:10 
GeneralRe: Passing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Dwayne Barsotta27-Jan-18 12:20
memberDwayne Barsotta27-Jan-18 12:20 
GeneralRe: Passing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Gerry Schmitz27-Jan-18 12:54
mveGerry Schmitz27-Jan-18 12:54 
GeneralRe: Passing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Dwayne Barsotta27-Jan-18 19:47
memberDwayne Barsotta27-Jan-18 19:47 
GeneralRe: Passing Data From a window to the mainview(shellViewModel) using EventAggregator - WPF Caliburn.Micro Pin
Gerry Schmitz28-Jan-18 8:28
mveGerry Schmitz28-Jan-18 8:28 
QuestionWPF ListCollectionView CustomSort - how to turn off live sorting Pin
Jonas Thor27-Jan-18 1:16
memberJonas Thor27-Jan-18 1:16 
AnswerRe: WPF ListCollectionView CustomSort - how to turn off live sorting Pin
Gerry Schmitz27-Jan-18 12:19
mveGerry Schmitz27-Jan-18 12:19 
GeneralRe: WPF ListCollectionView CustomSort - how to turn off live sorting Pin
Jonas Thor31-Jan-18 4:00
memberJonas Thor31-Jan-18 4:00 
GeneralRe: WPF ListCollectionView CustomSort - how to turn off live sorting Pin
Gerry Schmitz31-Jan-18 6:03
mveGerry Schmitz31-Jan-18 6:03 
QuestionDeploy desktop app with Target .net framwork 4 using Visual stuidio 2017 Pin
mhemant23-Jan-18 22:56
membermhemant23-Jan-18 22:56 
QuestionStrange RadioButton Binding Problem Pin
Kevin Marois20-Jan-18 9:55
professionalKevin Marois20-Jan-18 9:55 
AnswerRe: Strange RadioButton Binding Problem Pin
Richard Deeming22-Jan-18 8:16
mveRichard Deeming22-Jan-18 8:16 
QuestionWPF Desktop client on Win XP Pin
mhemant18-Jan-18 1:20
membermhemant18-Jan-18 1:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.