Jump to content

"Out of memory exception when loading image with bitmap

- - - - -

  • Please log in to reply
No replies to this topic

#1
Dumpen

Dumpen

    Newbie

  • Members
  • PipPip
  • 14 posts
Hello all

I have a mysql table with some rows in it that contain a path to a jpg file.

Here is a example of the path:
images/portfolio/lille_ilveaWebshop.jpg

The file excists on the webhost so that is not a problem.

I am loading the jpg file into a bitmap in a foreach.

It works fine when I am on a local server, but when I upload it to my webhost it says:

Quote

Server Error in '/' Application.
Out of memory.

Exception Details: System.OutOfMemoryException: Out of memory.

[OutOfMemoryException: Out of memory.]
System.Drawing.Bitmap..ctor(String filename) +376480
Referencer.Page_Load(Object sender, EventArgs e) +561
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

I cant seem to figure out just why it would do that.

Here is the code I am using:
            foreach (DataRow Row in objPortFac.VisReference(refKatID).Rows)

            {

				// Create a new bitmap with the path from the row

				// fldStortBillede is the field that contains the path

				Bitmap objStortBillede = new Bitmap(Server.MapPath(Row["fldStortBillede"].ToString()));


				// Dispose the bitmap after use

				objStortBillede.Dispose();

}

Any suggestions?

Edited by Dumpen, 17 June 2009 - 11:09 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users