ADsOpenObject() returns -2147024882 (0x8007000E) -> OUT_OF_MEMORY

寵の児 提交于 2019-12-23 07:28:30

问题


I have a C++ DLL that is used for authentication that gets loaded by a Windows service for every login.

In that DLL I use the Windows ADSI function ADsOpenObject() to get a user object from Active Directory.

HRESULT hr = ADsOpenObject(L"LDAP://rootDSE",
                           L"username",
                           L"password",
                           m_dwADSFlags,
                           IID_IDirectorySearch,
                           (void**)&m_DSSearch);

Generally this works since years. But currently I get the error code

-2147024882 (0x8007000E)

which is OUT_OF_MEMORY. When I restart the service that is using my DLL then it runs fine for weeks but then the errors start occuring.

Now I can't find what is out of memory. The task scheduler looks fine and free memory is plenty.
What can I do to fix that?


回答1:


which is OUT_OF_MEMORY.

It is E_OUTOFMEMORY, a COM error code. The description isn't very helpful, this error code tends to be returned for any "out of resources" errors by Microsoft code, not just memory. Could by an internal limit being reached, could be a winapi call that fails.

And it is not necessarily limited to the direct software involved. A mishaving device driver that leaks kernel pool memory can be the indirect source of the mishap for example.

You'll be lucky if you can find something back in the Application event log, look both in the machine that reports the error as well as the domain server. Task Manager might give a clue, add the Handles, GDI Objects, USER Object, Commit size, Page pool and NP Pool columns. Pretty hard to give specific advice beyond this. It is no doubt a leak, quacks loudly like one when you have to restart a machine periodically to recover. Good luck hunting it down.




回答2:


Are you calling Release on m_DSSearch? Also if you are searching you need to call CloseSearchHandle or AbandonSearch. If you are not doing either of those, you could be slowly leaking memory.




回答3:


Your process could fragment the heap to a point so that ADsOpenObject can't find a consecutive piece of memory that is large enough.

You can use VMMap to profile your memory usage: http://technet.microsoft.com/en-us/sysinternals/dd535533

You could try enabling low fragmentation heap: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366750(v=vs.85).aspx




回答4:


If it is now starting to appear and it wasn't earlier, I would suppose one of two possibilities: it has to do with the time (more specifically the year, a milleniumbug of some kind). Another option would be a problem with 32/64 bit architecture.

Now mind that I don't program C++. But I do know a bit about MS errors (I have worked on a MS helpdesk...)



来源:https://stackoverflow.com/questions/20419852/adsopenobject-returns-2147024882-0x8007000e-out-of-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!