asp .net out of memory problem
<pre><code> private void GenerateThumbnails(double scaleFactor, string sourcePath,
 string targetPath) {
             int wi = Convert.ToInt32(Request.QueryString["dim2"]);
             int hi = Convert.ToInt32(Request.QueryString["dim1"]);
             using (var image =
 System.Drawing.Image.FromFile(sourcePath))
             {
                 var newWidth = (int)(wi);//(image.Width *
 scaleFactor);
                 var newHeight = (int)(hi);// (image.Height *
 scaleFactor);
                 var thumbnailImg = new Bitmap(newWidth, newHeight);
                 var thumbGraph = Graphics.FromImage(thumbnailImg);
                 thumbGraph.CompositingQuality =
 CompositingQuality.HighQuality;
                 thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
                 thumbGraph.InterpolationMode =
 InterpolationMode.HighQualityBicubic;
                 var imageRectangle = new Rectangle(0, 0, newWidth,
newHeight);
                 thumbGraph.DrawImage(image, imageRectangle);
                 int getwal = newWidth - 108;
                 int gethi = newHeight - 30;
                 SolidBrush brush = new SolidBrush(Color.FromArgb(113,
 255, 255, 255));
                 thumbGraph.DrawString("myfile", new Font("Arial", 12,
 System.Drawing.FontStyle.Bold), brush, getwal,gethi);
                 thumbnailImg.Save(targetPath, image.RawFormat);
             } }
</code></pre>

<p>hi i am getting error while uploading pics</p>

<p>i get the error of</p>

<p>Out of memory.  Description: An unhandled exception occurred during
 the execution of the current web request. Please review the stack
 trace for more information about the error and where it originated in
 the code. </p>

<pre><code>Exception Details: System.OutOfMemoryException: Out of memory.

 Source Error: 


 Line 177:            thumbGraph.InterpolationMode =
 InterpolationMode.HighQualityBicubic; Line 178:            var
 imageRectangle = new Rectangle(0, 0, newWidth, newHeight); Line 179:  
 thumbGraph.DrawImage(image, imageRectangle); Line 180:           
 thumbnailImg.Save(targetPath, image.RawFormat);
</code></pre>
