Perhaps a memory leak OR?

Would appreciate any help here.

A brief description of the scenario -

The server has COM + (written in C #). The task of this COM is to take the file name, page number of the multi-page tiff file, and resolution to convert it to a gif file image. This COM is called from a web application using a proxy server. The website receives the converted image and displays it in the requested resolution. For printing - 2 requests - 1 for screen resolution, 2nd in full resolution (which is printed using window.print ()).

The problem is

Once the server goes out of memory and the images are not displayed on the website. The server must be restarted periodically.

Error

EventType clr20r3, P1 imageCOM.exe, P2 1.0.0.0, P3 4fd65854, P4 prod.web.imaging, P5 1.0.0.0, P6 4fd65853, P7 1a, P8 21, P9 system.outofmemoryexception, P10 NIL.

Here is the error(s) on the web server (these continuously appear every minute) ….

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---

I do not have access to the production server, but the error sent by sysadmin indicates OutOfMemory.

, - -

  • Perfmon - , Process/Private Bytes , .Net CLR memory/# . , , . .
  • - 8% 80% . 3% - 12%, , 75% -85%. .
  • COM, , gcroot ..

    • . 1 , . - 1 () , .
    • - .
    • . ( ). , . , , 1.

, , - .

EDIT:

Bitmap retVal;

      using (MemoryStream buffer = new MemoryStream(doc.FileData, 0, doc.DocumentSize, false, false))
      {
        using (Bitmap original = new Bitmap(buffer))
        {
        //select the page to convert and
        //perform scaling - full resolution or the requested resolution.  
        }
      }

      using (MemoryStream buffer = new MemoryStream())
      {
        retVal.Save(buffer, ImageFormat.Gif);
        retVal.Dispose();
        return buffer.GetBuffer();
      }
+5
2

, . , , outofmemory, , , . .

0

, Image (, Bitmap) , . , tiff , gif. Bitmap, ( ).

+1

All Articles