I know that the OS will sometimes initialise memory with certain patterns such as 0xCD and 0xDD.  What I want to know is when and why this happens.

When

Is this specific to the compiler used?

Do malloc/new and free/delete work in the same way with regard to this?

Is it platform specific?

Will it occur on other operating systems, such as Linux or VxWorks?

Why

My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler catch exceptions.

Can you give any practical examples as to how this initialisation is useful?

I remember reading something (maybe in Code Complete 2) that it is good to initialise memory to a known pattern when allocating it, and certain patterns will trigger interrupts in Win32 which will result in exceptions showing in the debugger.

How portable is this?


Question: WD Black 2.5 sata drive slow on windows 8. Sector size is 4k. What gives? 40MBps write
Answer: How have you used this drive? If it is quite new, the solution might be as simple as formatting (not quick-formatting) the drive.
I remember a time when HDDs came unformatted and your PC had to do a format on the blocks it was going to write to, before it could actually write the files. (If the drive had been formatted completely, the performance would be as expected and consistent)
But I am not sure whether this scenario still applies today.

My suggestion:
Create a partition on the drive (choose a size as large as possible but do not format the newly created partition) and run the test again.
Then format said partition and try again.