Re: What's wrong with alloca() ?

pcg@aber.ac.uk (Piercarlo Grandi)
Thu, 26 Dec 1991 23:34:51 GMT

          From comp.compilers

Related articles
What's wrong with alloca() ? preston@dawn.cs.rice.edu (1991-12-19)
Re: What's wrong with alloca() ? apang@mindlink.bc.ca (1991-12-15)
Re: What's wrong with alloca() ? pardo@cs.washington.edu (1991-12-21)
Re: What's wrong with alloca() ? preston@dawn.cs.rice.edu (1991-12-22)
Re: What's wrong with alloca() ? wjw@eb.ele.tue.nl (1991-12-23)
Re: What's wrong with alloca() ? David.Chase@Eng.Sun.COM (1991-12-23)
Re: What's wrong with alloca() ? pcg@aber.ac.uk (1991-12-26)
Re: What's wrong with alloca() ? wicklund@intellistor.com (1991-12-30)
Re: What's wrong with alloca() ? wws@renaissance.cray.com (1991-12-30)
Re: What's wrong with alloca() ? jfc@athena.mit.edu (1991-12-31)
Re: What's wrong with alloca() ? GORMAN_B@prime1.lancashire-poly.ac.uk (Barry Gorman) (1992-01-03)
Re: What's wrong with alloca() ? rankin@eql.caltech.edu (1992-01-05)
Re: What's wrong with alloca() ? pcg@aber.ac.uk (1992-01-05)
[1 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: pcg@aber.ac.uk (Piercarlo Grandi)
Keywords: storage
Organization: Coleg Prifysgol Cymru
References: 91-12-075 91-12-081
Date: Thu, 26 Dec 1991 23:34:51 GMT

On 22 Dec 91 18:08:57 GMT, preston@dawn.cs.rice.edu (Preston Briggs) said:


preston> pardo@cs.washington.edu (David Keppel) writes:


pardo> By the time you've added these calls you're just about all the
pardo> way to having ``object stack'' allocation, called ``obstacks'' in
pardo> GNU terminology. An obstack is an allocation region that can be
pardo> used for incremental allocation and then freed all at once.


preston> I hadn't read of obstacks, but they sound like the "arenas"
preston> described in


preston> Fast Allocation and Deallocation of Memory Based on Object
preston> Lifetimes David R. Hanson Software - Practice and Experience
preston> January 1990, 20(1)


Actually alloca() and obstacks are variations on controlled storage
allocation in PL/1. alloca() and obstacks come from people that almost
certainly were using at some time Multics, and its PL/1 compiler.


preston> His implementation is very small and simple. [ ... ]
preston> However, alloca is still useful. In one example, I use it in a
preston> deeply recursive tree walk, allocating structures of different
preston> sizes. We don't want an arena or obstack, since different
preston> pieces become free at different times


If you want to allocate memory in a LIFO fashion, that's controlled
storage, in one form or another; if you want lifetimes not to be nested,
then it's heap storage. Maybe you are saying that you want to allocate
heaps in a LIFO fashion. Well, again in PL/1 there was a concept of
area, in which one could do nonnested allocations, and which could be
allocated in controlled storage.


Both controlled and area storage are very useful and important concepts;
in particular areas plus the idea of based (relative) pointers make it
possible to have efficient position independent data structures.


PL/1 had its interesting points... (controlled and area storage and
based pointers are actually present in other languages, like MUPL, but
not all together).
--
Piercarlo Grandi | ARPA: pcg%uk.ac.aber@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth | UUCP: ...!mcsun!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@aber.ac.uk
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.