none
Native Images + LoaderOptimization RRS feed

  • Question

  • We have a C++/unmanaged Windows application that uses .NET resources.  We also have a content subsystem that uses WPF that is makes use of and the assemblies are NGEN'ed to improve loading performance.

    One of the other benefits we'd like to realize is to have different instances of this application be able to share these native images to improve overall memory usage.

    I understand that one of the critieria to be able to enable this is to apply the LoaderOptimation attribute.  The question is...is this possible with an unmanaged application to set this?  Since it loads .NET, it does have an application domain...we also have a config file for the application...but of course it doesn't have a static main entry point as a "pure" .NET application would.

    Thanks


    Kelly Hilliard

    Wednesday, October 10, 2012 4:46 PM

Answers

All replies

  • I guess it also bears asking...is it necessary to declare the application as domain-neutral to realize this stated benefit (from NGEN documentation):

    "Improved Memory Use

    Native images can significantly improve memory use when code is shared between processes. Native images are Windows PE files, so a single copy of a .dll file can be shared by multiple processes; by contrast, native code produced by the JIT compiler is stored in private memory and cannot be shared.

    Applications that are run under terminal services can also benefit from shared code pages.

    In addition, not loading the JIT compiler saves a fixed amount of memory for each application instance."


    Kelly Hilliard

    Wednesday, October 10, 2012 5:07 PM
  • Hi Kelly,

    Welcome to the MSDN Forum.

    I am trying to involve some other one into this thread. Please wait it patiently.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, October 11, 2012 10:12 AM
    Moderator
  • Thank you...I eagerly await further updates!

    Kelly Hilliard

    Friday, October 12, 2012 9:28 PM
  • Mike,

    It has been a while since I've heard anything...any updates?

    Thanks,


    Kelly Hilliard

    Wednesday, October 17, 2012 12:46 PM
  • Hi Kelly,

    Not yet.

    If this is very urgent and important, I suggest you try a chared call:

    to obtain the phone numbers for specific technology request please take a look at the web site listed below.

    http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS  

    If you are outside the US please seehttp://support.microsoft.com for regional support phone numbers.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, October 18, 2012 2:32 AM
    Moderator
  • Hi Kelly,

    For your content subsystem which is WPF, it would be good to continue to have the assemblies NGened. Now, if you have multiple application domain architecture, I would recommend marking the assemblies as domain-neutral rather than domain-specific. Do consider http://blogs.msdn.com/b/junfeng/archive/2004/08/05/208375.aspx if you plan to do so. An assembly can be loaded as domain-neutral by setting the LoaderOptimizationAttribute on the assembly's main method to either MultiDomain or MultiDomainHost.

    Regarding your native application which will be a mixed-mode assembly, Ngen should work as expected. I would recommend you to GAC the mixed-mode assemblies. Check http://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-measuring-working-set-with-vmmap.aspx for more information on to verify if you observe the same results.

    Thanks,

    Gaurav


    Thursday, October 18, 2012 3:24 PM
  • Sorry for the late replay...thanks for the information.

    Kelly Hilliard

    Monday, December 10, 2012 1:32 PM