Path: utzoo!mnetor!uunet!husc6!mailrus!nrl-cmf!cmcl2!phri!dasys1!raylau From: raylau@dasys1.UUCP (Raymond Lau) Newsgroups: comp.sys.mac.programmer Subject: Re: DAHandler and memory management Message-ID: <3819@dasys1.UUCP> Date: 11 Apr 88 03:36:37 GMT References: <3378@crcge1.UUCP> Organization: The Big Electric Cat Lines: 46 Keywords: DA memory Summary: Memory allocations under DA Handler In article <3378@crcge1.UUCP>, ranson@crcge1.UUCP (D. Ranson CNET) writes: > > A friend of mine is a DA developper, and is experiencing many difficulties > with DAs under Multifinder, running in the DAHandler partition. The problems > seem related to memory management: > - Cut and paste of large clipboards (4K on a 1M Mac+) is impossible. > - NewPtr and NewHandle do not always return nil when the memory is not > available (!). > > The same DAs have been tested running in the partition of a simple DA shell > application (by opening the DA with the option key down). In this setup, all > memory related problems disappear. > > Is this a bug in the DAHandler? > > Daniel Ranson > ...!mcvax!inria!crcge1!ranson I don't know the answer to your question per se....but an idea to relate. Recently, while implementing UnStuffIt DA, I needed around 160k in a few large structures. (And about 5k in a small one.) For the large one I stuck to using the MF Temporary Memory allocation routines. (WHICH, I might add, are not included in LSC 2.15 glue!) Only allows for non-relocatable blocks...but...if you need, lock them in place and dereference them. (Of course, when through, get rid of them.) When temp mem. allocation isn't available, I stuck w/NewPtr... (The DA was designed to be transient in nature, so I didn't bother w/a relocatable block.) For the 5k structure, a simple NewPtr... Under MF, if not enough memory, I get the appropriate error msg. from the allocation routines. (I haven't been able to generate a case where the NewPtr of 5k fails for sure and the rest succeeds, so I don't know... I'd check MemError instead of checking for NIL--actually, that's what I do do.) Now.....where's LSC 3.0..... What's the price for upgrading..... So many questions, so little time. -Ray (raylau@dasys1.UUCP)