Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!apple!shebanow From: shebanow@Apple.COM (Andrew Shebanow) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C malloc Message-ID: <9506@goofy.Apple.COM> Date: 31 Jul 90 19:43:02 GMT References: <23421@dartvax.Dartmouth.EDU> Organization: Apple Computer Inc., Cupertino, CA Lines: 28 In article <23421@dartvax.Dartmouth.EDU> llama@eleazar.dartmouth.edu (Joe Francis) writes: >1) How does malloc/free actually work on the mac? >2) How is the performance? >3) Are there any problems you have run into? I discussed this in my article "Using C++ Objects In A Handle Based World," in Issue 2 (April 1990) of d e v e l o p. Its a little too long to repeat here, so I would encourage you to get a copy of the magazine. Its available by calling (800) 331-4164 (CA only) or (800) 443-9637 (US), or by writing: d e v e l o p Apple Computer, Inc. P.O. Box 531 Mt. Morris, IL 61054 malloc's performance is quite good, but it can have a detrimental effect on heap fragmentation, so you should avoid it if you also want to do "Mac-like" things (e.g, windows, menus, quickdraw, etc.). In general, I would strongly recommend against using it unless you are doing a straight port of a textual app - calling NewPtr is just as easy to write, and the storage headaches are a lot smaller (although the performance is, admittedly, quite a bit worse than malloc). Good luck, Andrew Shebanow DTS Engineer Emeritus Apple Computer, Inc.