[Troubleshooting Tool] Desktop Heap Monitor

Win32 Subsystem Desktop Heap이라는 Kernel Mode Internal Heap을 사용한다. 여기서 말하는 Desktop 이라는 것은 Windows, menu와 같은 user interface objects를 가지고 있는 논리적인 display surface 를 의미한다. 그러므로, Desktop heap은 이와 같은 user interface objects를 저장하고 있는 메모리 영역이다. 그러므로, 이러한 Heap 영역이 고갈되었을 경우는 화면이 깨지거나 Window가 생성되지 않거나 등등 Win32k.sys User32.dll과 관련이 있을만한 일이 발생할 수 있다. 대표적으로 임의의 Process 수행 시에 STATUS_DLL_INIT_FAILED(0xC0000142) 오류가 user32.dll에서 발생하는 경우를 경험할 수 있다.

Desktop Heap Monitor 는 이러한 Heap 영역을 monitoring 하는 도구이다.

http://www.microsoft.com/downloads/details.aspx?familyid=5cfc9b74-97aa-4510-b4b9-b2dc98c8ed8b&displaylang=en에서 Public 하게 download 받을 수 있다.

 

그리고, Desktop Heap Monitor의 설정방법은 문서 Error message that is similar to the following when you try to install the Desktop Heap Monitor tool: "dheapinst - Win32k.sys symbol load error, correct symbol required" http://support.microsoft.com/kb/914216 를 참조할 수 있다. (DheapMon Vista에서 지원하지 않는다)

 

Desktop Heap Information Monitor Tool (Version 7.0.2727.0)

Copyright (c) 2003-2004 Microsoft Corp.

-------------------------------------------------------------

  Session ID:    0 Total Desktop: (  5824 KB -    8 desktops)

 

  WinStation\Desktop            Heap Size(KB)    Used Rate(%)

-------------------------------------------------------------

  WinSta0\Default                    3072              5.7

  WinSta0\Disconnect                   64              4.0

  WinSta0\Winlogon                    128              8.7

  Service-0x0-3e7$\Default            512             15.1

  Service-0x0-3e4$\Default            512              5.1

  Service-0x0-3e5$\Default            512              1.1

  SAWinSta\SADesktop                  512              0.4

  __X78B95_89_IW\__A8D9S1_42_ID       512              0.4

-------------------------------------------------------------

 

권고하지는 않지만 individual Desktop heap Configuration 가능하다. Desktop heap 할당에 대해서는 다음의 registry에서 제어할 있다.

 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

 

해당 Windows Value default value 다음과 같다.

 

          %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows

          SharedSection=1024,3072,512 Windows=On SubSystemType=Windows

          ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3

          ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off

          MaxRequestThreads=16

 

상위 value “SharedSection=” 부분에서 Desktop heap할당을 실제로 제어할 수 있는 데, 해당 값들의 의미는 다음과 같다.

-       1024: 모든 Desktop 의 일반적인 shared heap size(1024 Kbytes). 이 값은 건드리지 않는 다.

-       3072: Interactive window station과 관련된 각 Desktop heap size (3072 Kbytes), 그러므로, Hooks Menu, Windows 그리고 String 같은 Objects는 해당 Memory 영역을 소비한다고 보면 된다.

-       512: Non-interactive window station과 관련된 각 Desktop 을 위한 Desktop heap size(512 Kbytes)

조절하는 방법에 대해서는 예를 들어, 하나의 Desktop Heap Size가 부족해서 문제가 된다면, 2, 3번째 값을 기본값보다 크게 설정한다. 또 다른 예로 Non-interactive desktop 개수 자체를 증가시키길 원한다면, 3번째 값을 기본값에 비해 작게 설정하면, 더 많은 desktop 이 생성될 수 있다.

 

유사하게 특정 Application에서 상당히 많은 GDI 개체를 사용하고 반환을 하지 않을 경우에도 간혹 Not enough resource(Memory) 와 유사한 오류를 확인할 수 있는 데, (흔히, Virtual Memory 부족 외에도 이러한 resource 부족 에러는 다양하게 발생할 수 있다.) 하여 이러한 GDI Object leak과 같은 Issue Task Manager에서 쉽게 GDI Object 개수를 확인하거나 GDIObject Tool(http://www.fengyuan.com/download.html )을 이용할 수 있다.

실제, Handle leak이나 desktop Heap Leak에 대해서는 Kernel Dump를 수집할 필요가 있다. Handle Leak에 대해서는 Link http://www.dumpanalysis.org/blog/index.php/2007/07/15/crash-dump-analysis-patterns-part-13b/ 를 참조, 그리고, Desktop Heap Usage에 대해서는 Kernel Debugger가 제공하는 Userkdx extension을 이용할 수 있다.

 

Userkdx.dll user Extension

ddesk -vh <pdesk>             - Displays objects allocated in desktop
by 강세윤 | 2008/12/05 10:20 | Windows debugging | 트랙백 | 덧글(1)
트랙백 주소 : http://byung.egloos.com/tb/4765105
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by Lai Go at 2009/06/24 09:32
감사합니다. 잘 읽었습니다.

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >