May 18th, 2004

brief geeky digression

A QA engineer working on one of our applications recently got a new machine. The first time he ran the application, he got an error message saying "Your memory is running low." This was surprising, since he has 2GB of physical RAM, and plenty of hard disk space free.

An engineer on the team figured out that the problem was with a Windows API call that returns the amount of free memory as a signed int. Since signed ints max out at a little over 2 billion, the amount of free memory looked like a negative number. There's a newer API function that caps the returned size to 2GB, avoiding this problem.

I wrote the memory-checking code that called that original Windows API function in 1997. I have to admit, it didn't occur to me at the time to think what would happen when people had more than 2GB of physical RAM.