none
64-bit IIS memory limit !!! RRS feed

  • Question

  • I am creating a Web application using WebAPI 2 and running it on IIS.
    For some business reason the application is expected to consume more than 4 GB of memory.

    My machine is running IIS 64-bit on windows 10 pro 64-bit.

    When the memory consumption of the W3WP process exceeds 4 GB, I get an OutOfMemory exception, however I have read on many blogs and documentation links like ( https://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx#memory_limits and https://docs.microsoft.com/en-us/iis/troubleshoot/performance-issues/troubleshooting-native-memory-leak-in-an-iis-7x-application-pool )  that the memory limit for any 64-bit process running on 64-bit windows is above 1TB
    My machine already has a 16GB of RAM, and I opened the process monitor when I got the OutOfMemory exception to find out that W3WP is consuming only 4GB and there are still more than 7 GB free of my machines RAM

    What is missing here ??!! is there something wrong with IIS 10.0.16299.15 , or is there a limitation on ASP.NET or any .NET web application ? Is there a specific configuration I need to apply to let the web application consume more than 4 GB memory ?

    Monday, February 5, 2018 7:25 PM

Answers

  • One possible reason is if you are trying to allocate a big piece of contiguous memory (e.g. array or string). While your machine has memory in total, it may not have one contiguous piece due to memory fragmentation.
    Monday, February 5, 2018 7:38 PM

All replies

  • One possible reason is if you are trying to allocate a big piece of contiguous memory (e.g. array or string). While your machine has memory in total, it may not have one contiguous piece due to memory fragmentation.
    Monday, February 5, 2018 7:38 PM
  • You need to verify assumptions. You are assuming that the program is asking for a reasonable amount of memory. You don't show the code or anything specific about what is happening when you get the exception. I doubt that anyone can explain what is happening without more information.


    Sam Hobbs
    SimpleSamples.Info

    Monday, February 5, 2018 7:55 PM
  • Exactly , that was the case,

    When I divided the object creation into a so many small objects , it allocated memory successfully, however , asp.net failed to flush the big response object to the client and sent an exception.
    I guess the problem this time is that ASP.NET tried to allocate a single memory chunk (same as I did) for the large response object ,which is above 1 GB of memory , while sending it through the network drivers and just failed like me.Also keep in mind that my machine's memory was already gone after creating the above objects.
    Anyway, this experiment was just for explanatory purposes , I think I will change the scenario to something that can run .
    Thanks a million I learned a lot in this experiment :)

    [ArithmeticException: Overflow or underflow in the arithmetic operation.]
    
    [HttpException (0x80004005): An error occurred while communicating with the remote host. The error code is 0x80070216.]
       System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect) +268
       System.Web.Hosting.IIS7WorkerRequest.FlushCore(Boolean keepConnected, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32[] bodyFragmentTypes) +95
       System.Web.Hosting.IIS7WorkerRequest.FlushCachedResponse(Boolean isFinal) +796
       System.Web.HttpResponse.UpdateNativeResponse(Boolean sendHeaders) +1392
       System.Web.HttpRuntime.FinishRequestNotification(IIS7WorkerRequest wr, HttpContext context, RequestNotificationStatus& status) +182


    Monday, February 5, 2018 8:22 PM