Windows服务和连续内存分配

时间:2013-01-17 20:03:37

标签: windows delphi service delphi-7

我有一个启动Thread的Windows服务。该服务以SYSTEM ACCOUNT开头。

在线程中我使用CoInitialize,因为我有一个由COM对象管理的XML对象。

在某些窗口(7,2008 std,而不是全部)中,我的服务变得无条件地分配内存(12mb - > 50mb - > 100mb - > 500mb ....)。

如果我将服务的登录用户更改为管理员用户,问题就会停止。我无法理解发生了什么!

使用Process Explorer(Microsoft sysinternals),由于WaitForMultipleObjects(内核)的调用,我在DecodePointer看到一些线程被冻结。

这是堆栈:

Start address: ntdll.dll!RtlDecodePointer+0x32a

ntkrnlpa.exe!KeWaitForMultipleObjects+0xab7
ntkrnlpa.exe!KeWaitForSingleObject+0x492
ntkrnlpa.exe!PsGetCurrentThreadTeb+0x377
ntkrnlpa.exe!KiCheckForKernelApcDelivery+0x24
ntkrnlpa.exe!IofCallDriver+0x64
ntkrnlpa.exe!NtQueryInformationProcess+0x1c63
ntkrnlpa.exe!NtQueryDirectoryFile+0x5b
ntkrnlpa.exe!ZwQueryLicenseValue+0xbc6
ntkrnlpa.exe!ZwQueryDirectoryFile+0x11
fltmgr.sys!FltGetVolumeName+0xd9
fltmgr.sys!FltCheckAndGrowNameControl+0x36a
fltmgr.sys!FltGetTunneledName+0xb81
fltmgr.sys!FltGetDestinationFileNameInformation+0x245
fltmgr.sys!FltReleaseFileNameInformation+0x871
fltmgr.sys!FltIsDirectory+0x58b
fltmgr.sys!FltGetFileNameInformation+0x120
fltmgr.sys!FltRequestOperationStatusCallback+0x635
fltmgr.sys!FltGetIrpName+0x80c
fltmgr.sys!FltGetIrpName+0xd42
fltmgr.sys!FltGetIrpName+0x13b3
fltmgr.sys!FltDeletePushLock+0x1db7
ntkrnlpa.exe!IofCallDriver+0x64
ntkrnlpa.exe!RtlUpcaseUnicodeChar+0x17e7
ntkrnlpa.exe!ObReferenceObjectByHandle+0x976
ntkrnlpa.exe!ObOpenObjectByName+0x13c
ntkrnlpa.exe!RtlUpcaseUnicodeChar+0x6c9
ntkrnlpa.exe!NtCreateFile+0x34
ntkrnlpa.exe!ZwQueryLicenseValue+0xbc6
ntdll.dll!KiFastSystemCallRet
shell32.dll!SHLoadInProc+0x7f3de
shell32.dll!SHLoadInProc+0x7f42c
shell32.dll!SHLoadInProc+0x7f7b5
shell32.dll!SHLoadInProc+0x7f8a5
shell32.dll!SHLoadInProc+0x37487
ntdll.dll!TpSetWait+0x149
ntdll.dll!RtlDecodePointer+0x32a
kernel32.dll!BaseThreadInitThunk+0x12
ntdll.dll!RtlInitializeExceptionChain+0x63
ntdll.dll!RtlInitializeExceptionChain+0x36

1 个答案:

答案 0 :(得分:0)

听起来你的线程可能没有正确释放它创建的COM对象。

相关问题