Path: utzoo!attcan!uunet!husc6!mailrus!ames!amdahl!apple!dan From: dan@Apple.COM (Dan Allen) Newsgroups: comp.sys.mac.programmer Subject: Re: Flex fast lexical analyzer for MPW announcement. Keywords: %Globaldata Sucks Wind. Message-ID: <10896@apple.Apple.Com> Date: 23 May 88 05:15:27 GMT References: <8534@dartvax.Dartmouth.EDU> Reply-To: dan@apple.UUCP (Dan Allen) Organization: Apple Computer Inc, Cupertino, CA Lines: 39 I agree that a 32K global data limit is stupid. But the workaround in most cases is so trivial (especially in C) that why waste time worrying about it? USE THE HEAP! If a program needs big buffers or big arrays, then use New in Pascal, malloc in C, or NewPtr in general for the Mac. And with MultiFinder around, if a large buffer is only temporary, you can request the space from MultiFinder's heap and have your application look like a hero by running in a much smaller MultiFinder partition! (This last suggestion may not work real well with MPW tools, but works fine in apps.) It is very rare for an application to REALLY NEED more than 32K of global data. I submit that if an app is using more than 32K, then it is written wrong, that is, the allocation of the space should be at a more local scope or whatever. I have done a fair amount of work with several NON-TRIVIAL applications for the Mac. You may have even heard of them. HyperCard 1.2 312732 bytes of code, 25872 bytes of global data = 8% MPW Shell 2.0+ 179874 bytes of code, 20674 bytes of global data = 11% The percentages are simply global data divided by size of code (not including resources-just real live CODE). The MPW percentage is actually a bit high because it is written in C which does a lot of global data initialization which is included in the code size, whereas HyperCard is written in MPW Pascal and the initialization code is not automatic, although HyperCard does initialize portions of its global data. So anyway, I do not think that global data should be as big a deal. If you have a specific problem, I would be interested in hearing about it to see if my conjecture (that no well written app NEEDS more than 32K of global data) is actually true or not. Use the heap, and then if you still need more memory, buy more SIMMs. Dan Allen Software Explorer Apple Computer