How to detect memory leak using UMDH (User-Mode Dump Heap)

How to detect memory leak using UMDH (User-Mode Dump Heap)

1)      Configure symbols path by set an environment variable _NT_SYMBOL_PATH= to your symbols

2)      Using Gflags.exe enable User Mode stack trace database e.g. %windir%\Debuggers\gflags -i <processname.exe> +ust

3)      Take few snapshots

  1. umdh -p:<process id> -f:%temp%\umdh-start.txt
  2. umdh -p:<process id> -f:%temp%\umdh-stop.txt

4) Compare two snapshoot by by running umdh umdh-start.txt umdh-stop.txt –f:Delta.txt

Good luck, Eitan

please reply if you have any questions

Few steps to take into account in order to optimize application start time

 

1)      Remove dependency by reviewing the list of loaded modules and check the option to consolidate modules (DLL’s), you can statically review dependency by using depends.exe

2)      Reduce working set in order to improve application response time by review the working set content using VMMAP.exe,  consider an option to dynamically unload DLL’s

3)      Reduce I/O by consolidate program modules to single module vs. many tiny modules (DLL hall)

4)      Eliminate network calls on startup

How to use XPERF to detect memory leaks

How to use XPERF to detect memory leaks

First step:

Please modify the registry under:

HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management

and set the value:

DisablePagingExecutive (REG_DWORD) = 1

Then reboot before retrying tracing.

On start

Xperf -on base -buffersize 1024 -minbuffers 1024 -maxbuffers 1024 -f C:\KernelTrace.etl

xperf -start HeapSession -heap -Pids <ProcessID> -stackwalk HeapCreate+HeapAlloc+HeapRealloc -BufferSize 1024 -MinBuffers 2048 -MaxBuffers 2048 -f C:\AppHeapSession.etl

Collect for a few minutes or number of iterations you would like then run xperf -stop HeapSession -d C:\AppHeapSession.etl

more details @ http://www.idigitalhouse.com/Blog/?p=155

Enjoy, -Eitan

Before you start

Start optimize software performance by preparing the followings

1)      Test data – The set of data you would like to optimize (try to detect the common cases)

2)      Test tool – Write test software that is able to push the test data through the application

3)      Observation – Determine the set of objective measurements which indicates the throughput and performance characteristic of the machine e.g. performance counters, CPU utilization.

4)      Define goal – E.g. is app should work for maximum throughput or  work slower in order to enable the app to work efficiently side by side

Why to invest in software performance test?

In the last years I have worked on optimizing server/client applications for performance, I decided to share the experience in order to document the best practices that works for me

The reasons to invest in software performance

–     Produce capacity information to enable customers to evaluate the type and amount of hardware required

–      Measure key performance indicators in order to compare intermediate product builds

–      Improve software throughput by building tools that able to detect bottlenecks

–      Improve resources utilization by controlling the allocation timing, reusing and etc.