Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

šŸš— You set the rental price
šŸ” Secure bookings with verified renters
šŸ“ Track your vehicle with GPS integration
šŸ’° Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

dotMemory: A Complete Tutorial Guide dotMemory console command line tool




A Complete Practical Guide for Memory Profiling Using Command Line


1. šŸ” What is dotMemory Console?

dotMemory Console (also called dotMemory Command-Line Profiler) is the free, headless version of JetBrains dotMemory that allows you to:

  • Start .NET processes under memory profiling
  • Attach to a running .NET process
  • Automatically capture memory snapshots
  • Trigger snapshots based on conditions (timer, memory growth, process start)
  • Profile desktop apps, web apps, Windows services, IIS, WCF services
  • Capture snapshots on servers, CI pipelines, or production-like environments

The console profiler produces snapshot (.dmw) files that can later be opened in the dotMemory GUI (paid), but everything up to taking snapshots is 100% free.


2. šŸŽÆ Why Use dotMemory Console?

Because GUI profilers cannot run in many real scenarios.

dotMemory Console is perfect for:

āœ” Profiling on servers
āœ” Profiling CI/CD pipelines
āœ” Profiling performance test environments
āœ” Profiling apps running under service accounts
āœ” Profiling IIS, Kestrel, Windows services
āœ” Capturing snapshots automatically during load tests
āœ” Capturing leaks in production-like staging

In short:

You use dotMemory Console when you need real-world profiling without installing heavy GUI tools.


3. 🧠 Why Memory Profiling Matters

Memory issues cause:

  • High GC (Garbage Collection) → CPU spikes
  • Slow response times
  • Server crashes
  • Out-of-memory exceptions
  • Leaks (objects never collected)
  • Long-lived objects blocking GC
  • LOH (Large Object Heap) fragmentation

dotMemory Console helps you capture snapshots at the EXACT moment the issue happens, which is not possible with GUI tools.


4. 🧭 Where dotMemory Console Can Be Used

EnvironmentSupported?
Windows Desktopāœ”
Windows Serverāœ”
Linux (.NET Core)āœ”
macOS (.NET Core)āœ”
Dockerāœ”
Remote serversāœ”
CI pipelinesāœ”
IIS / IIS Expressāœ”
Windows Servicesāœ”
Console appsāœ”
ASP.NET Core apps (Kestrel)āœ”
Worker Servicesāœ”

5. šŸ— How dotMemory Console Works (Internals)

  1. You start profiling using commands like:
    • dotMemory start
    • dotMemory get-snapshot
  2. The profiler injects into the CLR runtime.
  3. It records allocation stacks, object references, and GC behavior.
  4. When a snapshot is triggered:
    • It dumps the entire managed heap.
    • It saves it into a .dmw workspace file.
  5. You later open .dmw in GUI (optional) to see:
    • Objects
    • Leaks
    • GC roots
    • Retained memory
    • Allocation hot paths

6. šŸ“¦ Installation (FREE)

Option 1: Global Install (Recommended)

dotnet tool install --global JetBrains.dotMemory.Console
Code language: CSS (css)

Check version:

dotmemory --version

Option 2: Local Install (Project-based CI)

dotnet new tool-manifest
dotnet tool install JetBrains.dotMemory.Console
Code language: CSS (css)

Option 3: Manual Download ZIP

Download from JetBrains (no account needed):
Search ā€œJetBrains dotMemory Console downloadā€

Extract to:

C:\tools\dotmemory\

Run:

dotMemory.exe
Code language: CSS (css)

7. 🧰 Features of dotMemory Console (FREE)

āœ” Attach to running processes
āœ” Profile apps as they start
āœ” Support for .NET Framework and .NET Core
āœ” Automatic triggers
āœ” No GUI needed
āœ” Zero license cost
āœ” Works on servers
āœ” Snapshot packaging
āœ” Works with IIS / Kiestrel / Windows Services
āœ” Suitable for CI/CD
āœ” Very low overhead


8. ⚔ Advantages

AdvantageExplanation
āœ” FreeThe full command-line profiler is FREE
āœ” Works on ServersNo need to install big GUI tools
āœ” AutomationPerfect for CI, load tests
āœ” No IDE dependencyWorks with any environment
āœ” Supports all .NET appsDesktop, web, service
āœ” Trigger-based profilingCatch leaks automatically
āœ” LightweightLow overhead vs GUI

9. ⚠ Limitations

LimitationExplanation
āŒ No visual interfaceMust open snapshots in GUI (paid)
āŒ Cannot analyze snapshots in CLIYou only collect snapshots
āŒ No real-time object graphGUI required to view
āŒ Not ideal for beginnersRequires understanding of profiling
āŒ Some runtime-specific features require GUIE.g., graph-based navigation

10. šŸš€ How To Use dotMemory Console (Hands-On)


āœ” 10.1 Take Snapshot of Running Process

By process name:

dotMemory get-snapshot MyApp.exe --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

By PID:

dotMemory get-snapshot 12564 --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

dotMemory chooses highest-memory instance if multiple processes exist.


āœ” 10.2 Start App Under Profiling

dotMemory start --save-to-dir=C:\snaps C:\MyApp\MyApp.exe

While app runs, you can manually trigger snapshot:

get-snapshot
Code language: JavaScript (javascript)

OR:

Ctrl + Enter

āœ” 10.3 Start .NET Core App (Kestrel)

dotMemory start-net-core --save-to-dir=C:\snaps -- MyApp.dll

āœ” 10.4 Automatic Snapshots (Memory Increase Trigger)

Example: snapshot when memory increases by 40%

dotMemory start --trigger-mem-inc=40% --save-to-dir=C:\snaps MyApp.exe

Perfect for:

āœ” Memory leaks
āœ” Load-test environments


āœ” 10.5 Snapshots Every X Seconds

Every 30 seconds:

dotMemory start --trigger-timer=30s --save-to-dir=C:\snaps MyApp.exe

āœ” 10.6 At App Startup

dotMemory start --trigger-start --save-to-dir=C:\snaps MyApp.exe

āœ” 10.7 Profile IIS

Restart IIS under profiler:

dotMemory start-iis --save-to-dir=C:\snaps

Attach:

dotMemory get-snapshot w3wp --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

āœ” 10.8 Profile Windows Service

Start profiling:

dotMemory start-windows-service MyServiceName --save-to-dir=C:\snaps

Take snapshot:

dotMemory get-snapshot MyServiceName --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

āœ” 10.9 Profile Any Process Started Later

Use this for ā€œcapture everything that starts nowā€:

dotMemory profile-new-processes --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

11. šŸ“Š What To See Inside Snapshots (When Opened in GUI)

Once you import .dmw file into dotMemory GUI, analyze:

  1. Overview Page
    • Total objects
    • Object count growth
    • Retained memory
  2. Inspections
    • Potential leaks
    • Types that increase
    • Long-lived objects
  3. Object Sets
    • Group by type
    • Size and count per type
  4. Retention Paths
    • Why object is not collected
    • GC roots
  5. Allocations
    • Methods causing heavy memory traffic
  6. Compare Snapshots
    • Before & after requests
    • Leak tracking

12. 🧪 Real Use Cases


āœ” 12.1 Detect Memory Leak in ASP.NET Core Under Load

Run:

dotMemory start --trigger-mem-inc=20% --save-to-dir=C:\snaps -- dotnet MyApp.dll

Start JMeter / k6 load test
→ Snapshots collected → Analyze retained size differences.


āœ” 12.2 Catch Leak in Windows Service

dotMemory get-snapshot MyServiceName --save-to-dir=C:\snaps
Code language: JavaScript (javascript)

Restart service → reproduce issue → compare snapshots.


āœ” 12.3 CI/CD Pipeline Memory Regression Check

In Jenkins/GitHub Actions:

dotMemory start-net-core --trigger-mem-inc=30% --save-to-dir=snaps -- MyApp.dll

Upload snaps to artifacts.


āœ” 12.4 Taking a Snapshot Right Before Crash

Use trigger:

dotMemory start --trigger-mem-inc=80% --save-to-dir=C:\snaps MyApp.exe

If memory shoots up (OOM), you get snapshot automatically.


āœ” 12.5 Auto Snapshots Every X Minutes During Long-Running Tests

dotMemory start --trigger-timer=120s --save-to-dir=C:\snaps MyApp.exe

13. šŸ“ Snapshot Storage and Recovery

Save snapshots:

--save-to-dir=C:\snaps

If profiling crashed:

dotMemory recover C:\snaps

14. 🧾 Important Commands Cheat Sheet

PurposeCommand
Start app under profilingstart
Start .NET Core appstart-net-core
Attach to processget-snapshot <PID>
Auto snapshot on memory growth--trigger-mem-inc=30%
Auto snapshot every X seconds--trigger-timer=20s
Profile IISstart-iis
Profile Windows Servicestart-windows-service
Profile processes started laterprofile-new-processes
Save snapshots--save-to-dir=snaps
Recover workspacerecover

15. šŸŽÆ Best Practices for Performance Engineers

āœ” Always save snapshots to a separate folder

āœ” Take a baseline snapshot

āœ” Take snapshot after load scenario

āœ” Always compare snapshots

āœ” Use memory-increase triggers for leaks

āœ” Do not profile production unless necessary

āœ” Automate snapshot collection in CI/CD

āœ” Keep snapshots small by recording at correct moments

āœ” Use GUI only for deep analysis


šŸŽ‰ FINAL SUMMARY

dotMemory Console = Free, powerful, server-ready memory profiler for .NET
It gives you:

  • Automatic snapshots
  • Profiling of server apps
  • Integration with performance testing
  • 100% automation via command line
  • Ability to capture leaks exactly when they happen
  • No need for GUI installation

To analyze snapshots → you need dotMemory GUI (paid), but all profiling and snapshot generation is free.


Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x