[net.micro.mac] segment loader bug

brian@ut-sally.UUCP (Brian H. Powell) (07/01/85)

Date: Wed 26 Jun 85 02:12:51-EDT
From: Robert Woodhead <Y.AJAJ-WOODHEAD-ROBERT%CRNL20A.BITNET@Berkeley>
Subject: Some helpful tips from a developer (LONG!)

>The Nasty Segment Loader Gotcha
>------------------------------

>This bug only hits very large programs with lots of segments, where
>you keep only parts of the program in memory at a time.  When a
>segment is loaded off disk, it is placed as low in memory as can be
>done (which is great).  When it is UnLoadSeg'd, it is free to float
>around memory OR be purged.  BUT!! When it has been UnLoadSeg'd and is
>still in memory, and the Segment Loader is called to load it, it says
>"oh, here it is, lets lock it in place"..  Can you say "heap
>fragmentation" boys and girls?  I knew you could.

>Apple Tech Support earned $50 worth of cookies fixing this one with a
>special patch to the loader.  So if you are having massive memory
>bombs on 128k Macs, check with them for the LSinstall and LSremove
>patches.

     I might mention that this patch is apparently not perfect.  A friend
of mine did some work on an extremely large game for the Mac.  He said it
worked great; "really cut down on the disk activity".  (By large game, I
mean ~70 segments.)
     Unfortunately, it crashed the game every 50000 or 60000 moves.  After
searching and searching, the bug turned up in the segment loader or its
patches.  The guy's boss decided that 50000 moves was too often.  Out goes
the patch.  After a lot more work, the game began to again run on a 128K mac,
but disk activity was a lot more common.
     Potentially, this is a great patch to have, but only if it works.


Brian H. Powell      brian@ut-sally.{ARPA,UUCP}

		 U.S. Mail:		 Southwestern Bell
		P.O. Box 5899		451-0842
		Austin, TX 78763
					 AT&T
					(512) 451-0842