ocbeta Posted November 16, 2003 Posted November 16, 2003 I get the following error: A first chance exception of type 'System.OutOfMemoryException' occurred in system.drawing.dll Additional information: Out of memory. On this line of code in the debuger: Dim imgImage As Bitmap = Bitmap.FromFile(strPath) Try Dim imgImage As Bitmap = Bitmap.FromFile(strPath) ImageList1.Images.Add(imgImage) Dim pic As New PictureBox() imgImage = imgImage.GetThumbnailImage(50, _ 50, Nothing, Nothing) pic.Image = imgImage pic.Dock = DockStyle.Top Panel2.Controls.Add(pic) GC.Collect() strPath = Nothing Catch err As System.Exception System.Windows.Forms.MessageBox.Show(err.Message) End Try I have tried disposing the image object. imgImage.Dispose() Then I just get an error on the Form1 Public Class definition. Also I have tried setting the variable imgImage = Nothing etc. I am very stumped at this point. Thanks for the help. Quote
Administrators PlausiblyDamp Posted November 16, 2003 Administrators Posted November 16, 2003 does strPath point to a valid filename? How big is the image you are loading (filesize, colour depth, dimensions etc)? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ocbeta Posted November 17, 2003 Author Posted November 17, 2003 See the thing is that the piece of code I had worked great with a file.searcher class I created. However, I needed to do invoke method so that the directory watcher code can be marshalled. Here is how the invoke method is working ByVal e As System.IO.FileSystemEventArgs) Dim File As File strPath = e.FullPath Dim mi As New MethodInvoker(AddressOf Me.AddThumbnail) Me.BeginInvoke(mi) Error Message: A first chance exception of type 'System.OutOfMemoryException' occurred in system.drawing.dll Additional information: Out of memory. The line that throws the exception is: Dim imgImage As Bitmap = Bitmap.FromFile(strPath) Thanks for the help. I have been having a lot of trouble with this. I think the issue is with the method invoker. I am not sure why. Quote
Menge Posted November 17, 2003 Posted November 17, 2003 hey! this happened on some "corrupt" jpeg files. some files that weren't completely downloaded, understand? just add some error catching there to find out which filename you are on and check the file. to fix this, i believe you could go and create a Bitmap file, load that file with GDI+ and draw it and create the texture from that Bitmap. i think that'd work. Quote Menge
ocbeta Posted November 17, 2003 Author Posted November 17, 2003 See the thing is that I never had this trouble with these images until I started using the method invoker etc. Thanks for the tip. I tried declaring some things as bmp etc, but that still did not work. I think there is an error witht he marshalling. Just need some more direction. Quote
1001how2 Posted April 21, 2009 Posted April 21, 2009 I am getting occasional out of memory errors from RadUpload. The server apparently has plenty of physical memory. The web site never uses more than 25% of available memory, until this error occurs. Max request size is limited to 16MB. The progress area appears when the upload is used, so I know the memory management is functioning. I have not been able to reproduce this myself, but I have talked to a couple of the users, and they said they were uploading relatively small files - well under the limit. I have included the stack trace for the error Any ideas on what could be causing this? Stack trace: at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength) at System.Text.StringBuilder.Append(String value) at Telerik.WebControls.RadUploadUtils.TextBodyWriter.Write(Byte[] buffer, Int32 index, Int32 count) at Telerik.WebControls.RadUploadUtils.RequestParser.WriteProcessedPart(Int32 start, Int32 end) at Telerik.WebControls.RadUploadUtils.RequestParser.ProcessRequest(RequestStream request) at Telerik.WebControls.RadUploadHttpModule.Context_BeginRequest(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Quote
Leaders snarfblam Posted April 21, 2009 Leaders Posted April 21, 2009 Among the exceptions that can be thrown from the Image.FromFile() method, per MSDN: OutOfMemoryException The file does not have a valid image format. -or- GDI+ does not support the pixel format of the file. [/Quote] Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.