how calculate size of memory that allocated from create specific windows object e.g. how memory allocated when createsemaphore API is called? there are any document that describe for all objects?

closed as unclear what you're asking by Guntram Blohm, 0xec, perror, peter ferrie, jvoisin Apr 27 '16 at 20:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


The allocation for most executive objects (like semaphores) is done inside the ObCreateObject() function. As you can see in ObCreateObject()'s prototype, one of the parameters is ObjectSizeToAllocate.

When a function like NtCreateSemaphore() is called, it calls ObCreateObject() with the size of the kernel object to be created (for example, sizeof(KSEMAPHORE)) as the value for ObjectSizeToAllocate.

So the easiest way to answer your question is to set a breakpoint on ObCreateObject() and examine the value of ObjectSizeToAllocate when it's called to create your object of interest.

Not the answer you're looking for? Browse other questions tagged or ask your own question.