Showing archive results for 2014

Feb 14, 2014
Post comments count0
Post likes count1

Debugging: Diagnosing why malloc is failing

Raymond Chen

A customer had some code which was experiencing memory allocation failures when calling (which maps to ). The function returns , and reports . However, there was still plenty of memory free: The customer was continuing their investigation but was looking for some pointers since the bug took a day to emerge. Could it be heap fragmentation? (The...

Code
Feb 12, 2014
Post comments count0
Post likes count0

The heavy metal umlaut encroaches into Seattle real estate

Raymond Chen

The heavy metal umlaut is creeping into Seattle real estate. I submit for your consideration the condominium known as Bleü. I can't even tell what language they are trying to pretend to be. There are other properties in Seattle with dots, but at least the dots aren't gratuitous. Hotel Ändra in Belltown takes its name from the Swedish ...

Non-Computer
Feb 12, 2014
Post comments count0
Post likes count1

What is this extra thread in my process?

Raymond Chen

A customer liaison asked: After applying Service Pack 2 to Windows Server 2003, my customer found that a simple MFC application (just using the template, no customization) has two threads when it is supposed to have only one. After five minutes, one of the threads exits. This doesn't happen on Windows Server 2003 RTM or Windows Server 2003...

Code
Feb 10, 2014
Post comments count0
Post likes count1

Excuses I learned from babies

Raymond Chen

I was visiting a friend of mine, and his young daughter was being unusually cranky. He explained, "Oh, she's teething." I filed that away as an excuse I could use the next time I felt cranky. "Sorry about that. I'm teething." Here's another excuse you might want to use: "No, I'm not drunk. I simply lost interest in remaining upright."

Non-Computer
Feb 10, 2014
Post comments count0
Post likes count1

Execute a file as if it were a program, even though its extension is not EXE

Raymond Chen

Today's Little Program executes a file as if it were a program, even though its extension is not EXE. The idea here is to prevent somebody from running your program by accident, so you give it an extension like . This is great for preventing somebody from running the program by mistake, but how do you do it on purpose? We're merely using the ...

Code
Feb 7, 2014
Post comments count0
Post likes count1

VirtualLock locks your memory into the working set, even if your threads are blocked

Raymond Chen

Today, a correction to an earlier article on . When you lock memory with , it will remain locked even if all your threads are blocked. As noted in the Follow-up section at the end of the referenced article, the behavior of the operating system never changed. Virtually-locked pages were never unlocked in practice. What changed is that an implement...

Code
Feb 6, 2014
Post comments count0
Post likes count0

The United States Team uniforms for the opening ceremony is rather hideous, and illegal, and a bit anachronistic

Raymond Chen

By the time you read this, the opening ceremony for a large sporting event organized by a lawsuit-happy organization may already have taken place. As part of the ceremony, the team representing the United States entered wearing ugly uniforms. They're so ugly that even the hideous Christmas sweater in your closet, the one with the reindeer and wre...

Non-Computer
Feb 6, 2014
Post comments count0
Post likes count1

If an asynchronous I/O completes synchronously, is the hEvent in the OVERLAPPED structure signaled anyway?

Raymond Chen

Yes. When an I/O completes (whether synchronously or asynchronously), the event is signaled and completion status notifications are queued. The function can be used to wait on an I/O that has already completed; it will merely return immediately. If you ask whether the I/O has completed, and the I/O completed synchronously, it will correctly repo...

Code