>===== Original Message From Dave Thomas <Dave / PragmaticProgrammer.com> =====
>Has anyone come across strange segv's and the like in Ruby apps
>under Windows 2000?

I have successfully avoided Windows 2000.  So this is going to
be more theoretical than anything else.

>We have a Ruby application that runs absolutely fine under Linux,
>Windows 98, and Windows NT. Under 2000, however, it will eventually
>and repeatably corrupt things and blow up. The current symptom we're
>seeing is that flo_to_s in numeric.c seems to corrupt the stack doing
>a sprintf.
>
>The problem seems somehow tied to garbage collection, in that the
>symptoms seem to vary depending on the number of objects created. You
>can also make it go away by judiciously disabling GC.

This fits perfectly with the theoretical point I have heard.

Windows 2000, unlike virtually any other OS, will try to hand
back to an application recently freed pages first.  This means
that if you have dangling pointers, you are likely to crash
under Windows 2000 even though the code works fine under other
operating systems.

Ironically this is a design *feature* intended to enhance the
overall stability of the platform.  The idea is to allow
developers to catch these hard to catch mistakes early in the
development process so that applications have higher quality.

Yeah, I know it is irritating.  I also think that it is one
of the better ideas Microsoft has had...

>If anyone's interested, Andy has isolated this down to about 30 lines
>of code (10 lines of Ruby, and 20 lines of C extension). But before we
>inflict this puzzler on anyone else, we were wondering if anyone had
>seem similar problems under 2000.

I have seen a design document from Microsoft on porting issues
for Windows 2000, and they discussed the above item, which
seems to my eyes like a reasonable possible cause.

Cheers,
Ben