From: lanford AT frihes61 DOT bitnet Date: Thu, 10 Sep 92 16:10:17 +0200 To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Repeated writes to cerr causes catastrophic thrashing Has anyone else observed the following? The simple program ++++++++++++++++++++++++++++++++++++++++++++++++++ #include main() { int i; for (i = 0; i <30; i++) cerr << "The quick brown fox jumps over the lazy dog" << "\n"; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++ crashes. More precisely: After printing fourteen lines it stops printing, and -- apparently -- begins frantically paging. If left to itself -- and if the swap file is on a smallish (2 Meg) ram disk -- it will before too long print out Fatal! disk full writing to swap file and terminate. This does NOT happen if the print instruction is replaced by cerr << "The quick brown fox jumps over the lazy dog\n" (i.e., the two strings concatenated) or by cout << "The quick brown fox jumps over the lazy dog" << "\n"; (i.e., cout instead of cerr.) Versions, etc: gcc version 2.2.2: Loaded from djgcc222.zip, djgpo222.zip, djgas138.zip, djdev108.zip (and, I believe, nothing else) Although I haven't checked directly, there is reason to believe that gcc 2.01 will give the same result, but gcc 1.39 will not. (Reason: The above simple program resulted from analyzing a reproducible crash of a bigger project. The same crash occurred with gcc 2.01, but not with 1.39.) Environment: Most of the exploration was done on a Toshiba T2200SX with 10 Megs of memory and the 386Max memory manager. The behavior doesn't change in the absence of memory management. Furthermore, the whole phenomenon seems to be machine independent: Various pieces were repeated on a number of different machines, and the place where thrashing begins is always independent of machine -- in particular, doesn't depend on the amount of memory. Oscar E. Lanford lanford AT frihes61 DOT bitnet (until October 6) lanford AT math DOT ethz DOT ch (thereafter)