Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!rex!ames!ads.com!potomac.ads.com!jtn From: jtn@potomac.ads.com (John T. Nelson) Newsgroups: comp.sys.mac.programmer Subject: How to malloc memory VERY dynamically and not out of app heap? Message-ID: <1991Mar24.172706.20807@potomac.ads.com> Date: 24 Mar 91 17:27:06 GMT Organization: Advanced Decision Systems, Arlington, VA Lines: 40 Here's an interesting problem. Let's say I want to write a text editor. This editor will want to handle files that might be very small (a couple of bytes) to perhaps several megabytes of text (big .Hqx files). To do this, I obviously want to use malloc. Problem is that the Mac OS mallocs (or NewPtr if you like) its space out of the application heap whose size is apparently determined by the application's suggested size (available from command-I in the Finder). Okay so far? Now... in order to handle those BIG files this means that I need an app size that's extremely large (several megabytes) but that means I cripple the application because then it won't run on smaller Macs with perhaps only two meg of memory. If I set the app size too small then it doesn't run on those big files. It would be nice to newPtr my space from a "free" area whose upper limit was not fixed and tied to the application's expectations. What does one do in these sort of situations or have I missed something conceptually? I would like to be able to run an app without telling the OS how much memory I need because I don't know how much. Many thanks for all of your help now and in the past. I remain yours... Dark Hacker! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ORGANIZATION: BLETCH (Bletcherous League of Evil Twisted Computer Hackers) UUCP: kzin!speaker@mimsy.umd.edu INTERNET: jtn@potomac.ads.com SPOKEN: Dark Hacker PHONE: (703) 243-1611 The Mythos of Dark Hacker: "Controlled by the sinister and shadowy "suits" Dark Hacker now employs the tools of computer science to free himself from the suit's will. By day he is a lackey... but at night when the city sleeps he becomes.... DARK HACKER!" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=