Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Why is .NET such a memory hog?

Why is .NET such a memory hog?

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpperformancehelpannouncement
24 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mattiash

    Joey Bloggs wrote: Interpreted / JIT it is about the same performance hit (in the same order of magnitude anyway) Certainly not! The CLR compiles to native code once and then re-uses the native code. It does not throw out any compiled code. Interpreted code is completely different from this. Something you don't mention is that managed code in fact can be much faster: - A managed execution environment can optimize on the specific machine you're running. - There are JVMs that re-compiles code that is frequently run and does more heavy optimizations on that code. - A managed execution environment can do cross-optimization over several assemblies, that weren't even known when designing the application. The above wouldn't be possible in a non-JITted environment. Before your next post, please spend some time learning how the CLR really works! Some good links are: Applied Microsoft .NET Framework Programming Writing High-Performance Managed Applications : A Primer (in the left columns you have several good articles as well) Articles by Jeffrey Richter MSDN Magazine

    S Offline
    S Offline
    Stephane Rodriguez
    wrote on last edited by
    #21

    So much for ngen.exe and yet, how do you handle the deployment of pre-jitted apps ? Everyone agrees that ngen.exe produces an image of your managed assembly(ies) in the GAC. Now if you intend to deploy pre-jitted apps with your setup program, this does not work : - the native image must be ready-to-use in the user's GAC, not in yours. So you have to prepare additional post-install steps to start ngen on HIS machine, so it does the job. - ngen is not distributed with the .NET run-time. In other words, it is not possible to execute ngen on a client machine after a setup, since there is no such tool to play with. - I am not sure if you are allowed to redistribute the ngen.exe tool from the .NET SDK. Quite the contrary, it is even likely that ngen.exe has a few other dependencies as well. (haven't spent time to debunk this though). - And final point, before ngen.exe can produce and copy a native image into the user's GAC, it must be allowed to do so. On some client machines, especially those not being local admin, it's likely you won't be able to do such things.


    RSS feed

    1 Reply Last reply
    0
    • J J Dunlap

      As I said before, if you run ngen.exe on the assemblies, they will no longer need to be JIT'ed at runtime, and therefore, will run much faster.

      "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
      "You must be the change you wish to see in the world." - Mahatma Gandhi

      I Offline
      I Offline
      igor1960
      wrote on last edited by
      #22

      How can I force ngen on the client? Or you are saying I should ngen it on my machine? What an advantage then? "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

      J 1 Reply Last reply
      0
      • I igor1960

        How can I force ngen on the client? Or you are saying I should ngen it on my machine? What an advantage then? "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #23

        igor1960 wrote: How can I force ngen on the client? You can run it from setup. igor1960 wrote: Or you are saying I should ngen it on my machine? It has to be ngen'ed on each computer it's installed/run on. igor1960 wrote: What an advantage then? Ngen speeds up start times, but it may actually slow things down overall, because it does not allow the compiler to do as many optimizations. However, it is useful where start times are crucial.

        "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
        "You must be the change you wish to see in the world." - Mahatma Gandhi

        I 1 Reply Last reply
        0
        • J J Dunlap

          igor1960 wrote: How can I force ngen on the client? You can run it from setup. igor1960 wrote: Or you are saying I should ngen it on my machine? It has to be ngen'ed on each computer it's installed/run on. igor1960 wrote: What an advantage then? Ngen speeds up start times, but it may actually slow things down overall, because it does not allow the compiler to do as many optimizations. However, it is useful where start times are crucial.

          "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
          "You must be the change you wish to see in the world." - Mahatma Gandhi

          I Offline
          I Offline
          igor1960
          wrote on last edited by
          #24

          You can run it from setup. It has to be ngen'ed on each computer it's installed/run on. So, I should run it during install? And I thought: .NET is all about security! BTW: I'm not sure you can even distribute ngen. Ngen speeds up start times, but it may actually slow things down overall, because it does not allow the compiler to do as many optimizations. However, it is useful where start times are crucial. About optimization: Do you know what floating point support CLR uses on each particular machine? What floating point precission to use?... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups