[BUG?] Slow file writing due to excessive GC

Bob Arning arning at charm.net
Tue Oct 9 17:18:53 UTC 2001


On Tue, 09 Oct 2001 17:07:43 +0200 Henrik Gedenryd <Henrik.Gedenryd at lucs.lu.se> wrote:
>When I file out a few files of source code in a fairly standard manner, I
>get a very weird timing profile: Roughly half the time is spent on garbage
>collection, even though Squeak reports 80M of free RAM, and the
>open:forWrite: shouldn't fail for any other reason I have been able to find.
>Some typical code for reproducing this is:
>
>MessageTally spyOn: [
>    {ClassOrganizer. StandardFileStream. SystemDictionary.
>            WriteStream. Symbol. DisplayScreen}
>        do: [:c | c fileOut]]
>
>Can anyone explain this behavior? This is a Mac VM (3.1.1, but it oughtn't
>matter).

To see if the file exists, it is opened in read-only mode. If this fails, then we know the file does not exist, UNLESS the open failed due to some sort of shared access restriction, so we do a garbage collection to allow any files that Squeak no longer needs to be closed, thus alowing us to retry the test. With this logic, testing for the existence of a file that does not already exist will cost a garbage colection.

Cheers,
Bob




More information about the Squeak-dev mailing list