We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

ASP.NET web api memory(RAM) problems [Answered]RSS

2 replies

Last post Dec 15, 2014 03:27 AM by ayyappa1984

  • ASP.NET web api memory(RAM) problems

    Dec 12, 2014 07:54 AM|ayyappa1984|LINK


    I have a asp.net web api which devlivers very small amount of data but heavily used .

    My method is

      public HttpResponseMessage GetFingerprint(string id, string fingerprintVersion, string snapshotVersion, string thesaurus)
                HttpResponseMessage badAccessResponse = CheckAccess(_serviceHelper, ExportCommon.Models.Request.Type.FingerprintDocument, null);
                if (badAccessResponse != null) return badAccessResponse;

                HttpResponseMessage response = Request.CreateResponse();

                FingerprintRequest fingerprintRequest = new FingerprintRequest();
                fingerprintRequest.id = id;
                fingerprintRequest.Resource = "Document";
                fingerprintRequest.FingerprintVersion = fingerprintVersion;
                fingerprintRequest.SnapshotVersion = snapshotVersion;
                fingerprintRequest.Thesaurus = thesaurus;

                var fingerprintStream = new FingerprintStream(fingerprintRequest);

                var mediaTypeHeaderValue = new MediaTypeHeaderValue("text/xml");
                mediaTypeHeaderValue.CharSet = "utf-8";

                response.Content = new StringContent(fingerprintStream.GetFingerprintsByDocId(), Encoding.UTF8, "text/xml");

                //response.Content = new PushStreamContent(fingerprintStream.WriteToStream, mediaTypeHeaderValue);

                return response;


    But the memory is constantly increasing . So in application poll , I have  a setting to limit and recyle at 7GB. Some time this is causing 500 Internal Server error on client side.

    Can some one let me know what could the possibel reasons that memory is getting increased.

    How can we clean memory?.


    Ayyappa K

    buffer iis memory webapi

  • Re: ASP.NET web api memory(RAM) problems

    Dec 12, 2014 10:30 PM|lextm|LINK

    It has nothing to do with ASP.NET Web API. What is your FingerprintStream? Freeing up such objects and you should be able to reduce memory footprint of this application.

    Please find a good enough memory profiler such as ANTS profiler, and then you can easily observe how the memory is used by the objects.

    buffer iis memory webapi

    Lex Li
    Want to have a chat on the issues you meet? Book an appointment at https://buy.stripe.com/cN24ia0yi7sAdIA7sv
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: ASP.NET web api memory(RAM) problems

    Dec 15, 2014 03:27 AM|ayyappa1984|LINK

    Thank you Lex,

    I will try using ANTS profiler .

    buffer iis memory webapi