Hallo,
ich habe ein Bild, welches eine Größe von 69 MB hat.
Dieses Bild lade ich in ein DoublebufferedPanel.
Das Bild kann ich in der Anwendung ohne MemoryException 4-mal ca. laden.
Danach bekomme ich eine Fehlermeldung, dass ich keinen Arbeitsspeicher mehr zur Verfügung habe.
Wenn ich im Task-Manager schaue, wird mir angezeigt, dass ich noch 3 GB frei habe, was also nicht am Arbeitsspeicher liegen kann.
Desweiteren wird das Bild komplett aus dem Arbeitsspeicher wieder gelöscht, was man auch im Task-Manager sehen kann.
Hier die Fehlermeldung:
Ich lade das Bild als Blob-Datei in ein MemoryStream, welchen ich mit Using und Try Catch, Finally verwende.
Außerdem verschiebe ich das DoublebufferedPanel, sobald das Bild geladen wurde.
Könnt ihr mir da helfen?
Danke
ich habe ein Bild, welches eine Größe von 69 MB hat.
Dieses Bild lade ich in ein DoublebufferedPanel.
Das Bild kann ich in der Anwendung ohne MemoryException 4-mal ca. laden.
Danach bekomme ich eine Fehlermeldung, dass ich keinen Arbeitsspeicher mehr zur Verfügung habe.
Wenn ich im Task-Manager schaue, wird mir angezeigt, dass ich noch 3 GB frei habe, was also nicht am Arbeitsspeicher liegen kann.
Desweiteren wird das Bild komplett aus dem Arbeitsspeicher wieder gelöscht, was man auch im Task-Manager sehen kann.
Hier die Fehlermeldung:
Quellcode
- System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unbehandelte Ausnahme</Description><AppDomain>VS.exe</AppDomain><Exception><ExceptionType>System.OutOfMemoryException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Nicht genügend Arbeitsspeicher.</Message><StackTrace> bei System.Drawing.Graphics.CheckErrorStatus(Int32 status)
- bei System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
- bei System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit)
- bei System.Windows.Forms.ControlPaint.DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft)
- bei System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
- bei System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
- bei System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
- bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
- bei System.Windows.Forms.Control.WmPaint(Message&amp; m)
- bei System.Windows.Forms.Control.WndProc(Message&amp; m)
- bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
- bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
- bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</StackTrace><ExceptionString>System.OutOfMemoryException: Nicht genügend Arbeitsspeicher.
- bei System.Drawing.Graphics.CheckErrorStatus(Int32 status)
- bei System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
- bei System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit)
- bei System.Windows.Forms.ControlPaint.DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft)
- bei System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
- bei System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
- bei System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
- bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
- bei System.Windows.Forms.Control.WmPaint(Message&amp; m)
- bei System.Windows.Forms.Control.WndProc(Message&amp; m)
- bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
- bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
- bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</ExceptionString></Exception></TraceRecord>
- Ein Ausnahmefehler des Typs "System.OutOfMemoryException" ist in System.Drawing.dll aufgetreten.
- Nicht genügend Arbeitsspeicher.
- Unbehandelte Ausnahme: OutOfMemoryException.
Ich lade das Bild als Blob-Datei in ein MemoryStream, welchen ich mit Using und Try Catch, Finally verwende.
Außerdem verschiebe ich das DoublebufferedPanel, sobald das Bild geladen wurde.
Könnt ihr mir da helfen?
Danke