• 0

[PowerShell] Lower Memory Consumption When using "cmd /c" instead of ".\" to run exe?


Question

I don't get this,

cmd /c " `"mysqldump.exe`" .. > $foo "
# vs
.\mysqldump.exe .. > $foo

PS process eats all my memory when using .\foobar.exe whereas going using cmd /c "foobar.exe" does not.

 

 

What the ###### is happening here? Ideas?

5 answers to this question

Recommended Posts

  • 0
  On 11/08/2016 at 16:55, rdlenk said:

Does the effect change at all if you use Start-Process?

Expand  

I think that did the trick! I think PS tried storing the file in memory before writing it to disk with the ">" op,

With Start-Process and -RedirectStandardOutput - it does not try to store the file in memory.

 

  • 0
  On 30/08/2017 at 12:47, Riva said:

In both scenarios foobar.exe is a child process of either powershell or cmd instance. Powershell is a managed process (.NET CLR) vs. CMD which is native app. Native apps have a lighter footprint and higher processor resolution. .NET CLR (and Java) tend to use a virtualised CPU in order to ensure type safety. .NET native solves this problem but it isnt as widely implemented yet.

 

Expand  

I don't think that explains it. I mean there is a difference between native and .NET but its minor for non-performance critical code. Like Start-Process just executes another executable and waits for it - so not much runs in .NET CLR anyway here.

 

As far as I remember (this topic is from a year ago and I don't work there anymore) - it just did nothing for a much longer time when launching from Start-Process versus indirectly through CMD. Like it wasn't an issue with higher process utilization - mysqldump through Start-Process was simply doing ######-all for a long time.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Popular Now

  • Posts

    • how am i gonna teach my grandma understand a new OS now ?
    • Well, Satya Nadella did say 30% of Microsoft's code is written by AI. Considering that code is also reviewed and tested by the same AI: garbage in, Microsoft code out.
    • Spotify 1.2.66.445 by Razvan Serea Spotify for Windows is your ultimate music and podcast streaming app, designed for a seamless listening experience. Enjoy millions of songs, curated playlists, and personalized recommendations tailored to your taste. Spotify delivers high-quality audio streaming with bitrates up to 320 kbps for Premium users and 160 kbps on the Free tier. Music is streamed in Ogg Vorbis format on the app and AAC on web browsers, ensuring efficient delivery and compatibility. Adaptive bitrate technology adjusts quality based on network conditions, while Premium users enjoy offline downloads for uninterrupted playback. Podcasts are streamed at slightly lower bitrates, typically 96-128 kbps, to balance quality and data usage. Spotify works across smartphones, desktops, smart speakers, game consoles, and more, with Spotify Connect enabling smooth cross-device playback. Features like real-time lyrics, curated playlists, and personalized EQ settings elevate the listening experience, making Spotify a versatile platform for music and podcasts alike. Spotify Free features: Stream Millions of Songs - Access a vast library of music across various genres and artists. Curated Playlists - Discover ready-made playlists for every mood and moment. Shuffle Play Mode - Enjoy songs in random order with shuffle-enabled playback. Personalized Recommendations - Get music suggestions based on your listening habits. Access to Podcasts - Explore a wide range of podcasts on topics you love. Ad-Supported Listening - Stream music with occasional audio and display ads. No Subscription Required - Enjoy music without any payment commitment. Cross-Device Sync - Listen seamlessly on mobile, desktop, or web browser. Basic Playback Controls - Play, pause, and skip tracks within shuffle limitations. Discover Weekly & Release Radar - Stay updated with custom playlists for new music. Download: Spotify 1.2.66.445 | ARM64 | ~100.0 MB (Free, paid upgrade available) View: Spotify Website | Web Player Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Understandable, they need to make money somehow to keep the service "free". If you're not paying with money, you'll pay with something else. In this case, it's ads. People will bitch about this (as usual), but it's basic economics, everything has a price, like YouTube (non-premium).
    • A sign of a man with absolutely no taste. Also the first American president to whine about American "jobs" while selling Chinese stuff for 5x or 10x the actual worth while slapping his stupid name on it. Like, what even is this, some really bad, humorless parody? Nope, it's the actual reality. Selling Chinese bible, selling EV's on White House front yard, selling Chinese phones that are wrapped in few microns of gold for 3x the value... It's so hilarious it's cringy af.
  • Recent Achievements

    • Week One Done
      patrickft456 earned a badge
      Week One Done
    • One Month Later
      patrickft456 earned a badge
      One Month Later
    • One Month Later
      Jdoe25 earned a badge
      One Month Later
    • Explorer
      Legend20 went up a rank
      Explorer
    • One Month Later
      jezzzy earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      637
    2. 2
      ATLien_0
      278
    3. 3
      +FloatingFatMan
      171
    4. 4
      Michael Scrip
      156
    5. 5
      Steven P.
      128
  • Tell a friend

    Love Neowin? Tell a friend!