Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,
Please help me out of this.....

When i am uploading the picture I am getting this exception...
<br />
Message: Out of memory.Stack Trace:<br />
at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit) at Helper.ResizeImage1(String FileName, String NewFileName, Int32 mwidth, Int32 mheight) at Attendee_UploadPhoto.lnkupload_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)<br />

I have a doubt that if Image size is too big I will get this problem is it right..If right what is the basic size can we give...can we increase that size plz let me know as earliest it will be helpful to me...

Thanks in Advance...............
Posted
Updated 4-Aug-11 1:35am
v5
Comments
RaisKazi 4-Aug-11 7:36am    
could you provide your code which is throwing this error?

1 solution

It may not be a memory problem as in RAM: you seem to be drawing an image on a button click, rather than in a Paint event. If you are constructing your own Graphics object(s) but not Disposing of them when you have finished, you may be running out of Graphics resources rather than physical / virtual memory.

Given that the max size of any single object in .NET is 2GB, you would need an image of about 24Kx24K pixcels to exceed it in a single object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900