ADsOpenObject() returns -2147024882 (0x8007000E) -> OUT_OF_MEMORY
Asked Answered
C

4

10

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?

Cordeelia answered 6/12, 2013 at 9:0 Comment(8)
Is the ActiveDirectory server out of memory?Nardi
No, it's not. Other applications don't have any problems with it too.Cordeelia
If I look at the source file "winerror.h" for error 14L, then I see the MessageText as Not enough storage is available to complete this operation. Any chance that this is a storage issue? See here on why I am using 14L.Lungwort
No, storage is available.Cordeelia
(void**)&m_DSSearch is taking the address of the m_DSSearch is there a possibility the pointer moves but you don't free that memory ? which might lead to memory leaks overtime ?Enlarge
Are you able to use a third-party tool to diagnose memory allocations?Homing
What do you mean by "The task scheduler looks fine and free memory is plenty."? Are you looking at system's available RAM or on process's virtual size?Malchy
Have you solved this enigma, please ?Examinant
M
4

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.

Mapel answered 11/12, 2013 at 22:54 Comment(0)
R
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.

Raby answered 11/12, 2013 at 22:40 Comment(0)
O
0

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

Offend answered 17/12, 2013 at 16:18 Comment(0)
F
-1

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...)

Filing answered 14/12, 2013 at 23:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.