Windows NT Heap Alignment on 64-bit Systems

ElonButNotMusk 0 Reputation points
2025-01-07T08:00:41.6966667+00:00

I am trying to develop my own heap for an IoT platform, which is supposed to be an equivalent NT heap of Windows for my masters degree.

From what I've seen, it appears like the NT Heap header on 64-bit systems seems to be 8 bytes long.

Whenever I allocate a chunk it seems like the address returned is divisible by 0x10. My first question is why is it divisible by 16? From what I've researched on Linux, it seems like other Heaps usually align to 8 bytes so it would be divisible by the size of pointer.

In addition, can the NT heap ever "break" this alignment and behave differently? Especially if I have reached a state where there is a lot of internal fragmentation? Will it ever align to 8? or to anything else?

I've tried to search for the answer online but I couldn't find a clear answer and wish to succeed in this task.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,956 questions
Windows for IoT
Windows for IoT
A family of Microsoft operating systems designed for use in Internet of Things (IoT) devices.
408 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,975 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.