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,42a57c8ee023f14d X-Google-Attributes: gid103376,public From: jsa@organon.com (Jon S Anthony) Subject: Re: Q: memory management Date: 1996/06/15 Message-ID: #1/1 X-Deja-AN: 160383221 sender: news@organon.com (news) references: organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-06-15T00:00:00+00:00 List-Id: In article Hannes Haug writes: > I'm new to Ada and have a question on memory management. Is > there a function like malloc in Ada ? I want just a pointer > to a certain amount of raw storage. the reserved word _new_ in an allocator context. For example, procedure Junk is type string_ref is access string; -- Dynamically allocate a string... -- msg : string_ref := new string'(Hello Marion, is that you?); .... end Junk; > I think "new Storage_Array (n)" will give me a little bit too > much storage. The array bounds need some space. I don't know what "storage_array" is, but don't worry about the space for bounds. It's all taken care of for you. > Does "Allocate (some_storage_pool, addr, n, Word_Size / Storage_Unit)" > work ? Which storage pool do I have to choose ? At this point don't worry about user defined storage pools and allocation/deallocation. Just use the standard predefined ones. Have a look at access types in the rationale or in the Lovelace tutorial: http://lglwww.epfl.ch/Ada/ /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com