From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d20ce8a4c2acf4e9 X-Google-Attributes: gid103376,public From: jhopper@erinet.com (jim hopper) Subject: Re: Mac memory allocation: NewPtr or Ada's "new" Date: 1997/03/17 Message-ID: <5gi2qa$n7i@server1.erinet.com>#1/1 X-Deja-AN: 226048079 Sender: -Not-Authenticated-[4123] References: Organization: EriNet Online 513 436-1700 (Voice) XDisclaimer: User not authenticated Newsgroups: comp.lang.ada Date: 1997-03-17T00:00:00+00:00 List-Id: Bill, gnat calls malloc for new, which is supplied by the mac standard c lib when doing standalone apps. calling new should be functionally equivalant to new_ptr. If i were you i would check out how the mac texts suggest c programmers do it (ie malloc vs new_ptr) and do the same as the issues are identical. try asking it that way in comp.sys.mac.programmer. sorry i don't do c on the mac unless i get paid double ;-) new_handle on the other hand is a whole nother ball park! Always use new_handle rather than creating pointer to pointer so the mac os can handle memory correctly for you. jim -------- In article brennanw@pond.com (William C Brennan) writes: > I'm learning to do Mac programming using GNAT under CodeBuilder, > and I'm a little confused about allocating memory from the heap. > Perhaps someone can help... > > I have two Mac programming texts, and both of them tell me that > when I want to allocate memory from the heap, I should call the > NewPtr function, which seems to be functionally equivalent to the > Ada "new" allocator. I'd prefer to use the "new" allocator because > it's not tied to an OS, but I would like to understand any > subtle differences which aren't apparent on the surface. > > Is there a operational difference between calling the MacOS NewPtr > and using Ada's "new" allocator? How is "new" implemented for > GNAT under MacOS?