Out of memory exception for ExtractThumbnail

  •  10-09-2006, 3:15 PM

    Out of memory exception for ExtractThumbnail

    Adam,
    Im getting this error when I preview a lot of images:
    {"Out of memory."}
    "   at System.Drawing.Image.GetThumbnailImage(Int32 thumbWidth, Int32 thumbHeight, GetThumbnailImageAbort callback, IntPtr callbackData)\r\n   at CuteEditor.Impl.ThumbGenerator.ExtractThumbnail()\r\n   at CuteEditor.Dialogs.ThumbnailHandler.ProcessRequest(HttpContext context)\r\n   at ASP.includes_cuteeditor_cuteeditor_files_dialogs_thumbjpeg_aspx.OnInit(EventArgs e) in c:\\Active Campus\\Guinness-2.1.1\\wwwroot\\activecampus\\admin\\Includes\\CuteEditor\\CuteEditor_files\\Dialogs\\thumbjpeg.aspx:line 6\r\n   at System.Web.UI.Control.InitRecursive(Control namingContainer)\r\n   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"
     
     
    In CuteEditor.Impl.ThumbGenerator.ExtractThumbnail, instead of doing
    using (Bitmap bitmap1 = new Bitmap(new MemoryStream(buffer1)))
          {
    I would do
     
    using (MemoryStream memoryStream = new MemoryStream(buffer1))
    {
       using (Bitmap bitMap = new BitMap(memoryStreatm))
       {
       }
    }
     
    If you look at the IL generated, MemoryStream.Displose never gets called :-)
     
    Let me know if you can make that change and get me an updated dll - I can test it out to ensure it works!
    Thanks
     
     
     
View Complete Thread