Native Module memory "leak" with Integrated .Net 4.0 (but not classic or 2.0)RSS

1 reply

Last post Apr 04, 2013 01:30 PM by garykibble

  • Native Module memory "leak" with Integrated .Net 4.0 (but not classic or 2.0)

    Apr 04, 2013 10:56 AM|garykibble|LINK

    I have a C++ Native Module that works fine when the AppPool is set to 2.0 Integrated or 4.0 Classic or when most Managed Modules are disabled. But when the App Pool is 4.0 Integrated on IIS 7.5 the memory (Private Working Set) increases about 10K with every http request and keeps climbing until all Ram is consumed.

    Are there changes needed to support 4.0 on IIS 7.5 in regardes to self-registering or returning control back to IIS after the module sends the HTTP response?  I'm following all the original MS code examples for Native Modules.

    A tester noted that the DLL is not getting loaded many times with .Net2.0 App pool, but the DLL gets loaded many times with .Net4.0 App pool. We suspect under 4.0 that each http request is loading the native module dll anew and not releasing it. Why?

    Here is the heart of my RegisterModule()

    DWORD dwRequestBits = RQ_RESOLVE_REQUEST_CACHE;
    hr = pModuleInfo->SetRequestNotifications(pFactory, dwRequestBits, 0 );
    // error handling snipped...
    pFactory = NULL;
    hr = pModuleInfo->SetPriorityForRequestNotification(dwRequestBits, PRIORITY_ALIAS_FIRST);

    My OnResolveRequestCache() creates a response and returns RQ_NOTIFICATION_FINISH_REQUEST

  • Re: Native Module memory "leak" with Integrated .Net 4.0 (but not classic or 2.0)

    Apr 04, 2013 01:30 PM|garykibble|LINK

    Problem seems to be unique to IIS7.5. I can not replicate it on IIS7.