oz@yunexus.yorku.ca (Ozan Yigit) (11/13/90)
In article <2183@kraftbus.opal.cs.tu-berlin.de> net@tubopal.UUCP (Oliver Laumann) writes: >This, of course, doesn't work when the amount of data to be stored >in the local buffer can't be determined at compile time. If it were >known at compile time, there would be no need to use alloca() in the >first place. Yes, Oliver, that example is somewhat restricted, but there *are* methods to allocate and de-allocate memory almost as conveniently and speedily as the usual stack allocation. You may wish to check out the following: %A David R. Hanson %T Fast Allocation and Deallocation of Memory Based on Object Lifetimes %J Software - Practice and Experience %V 20 %N 1 %D Jan 1990 %P 5-12 In this scheme, lifetime-indexed linked arenas are used for allocation. The allocation code is very simple and in-line. The algorithm totally avoids per-object de-allocation by using the lifetimes to reclaim the arenas. This allocator was developed as a way to improve the de-allocation speed of various data structures such as symbol-table entries, nodes for trees and dags in a C compiler. I think algorithms such as this one make further alloca discussions about as useful as alloca itself. :-) oz --- Where the stream runneth smoothest, | Internet: oz@nexus.yorku.ca the water is deepest. - John Lyly | UUCP: utzoo/utai!yunexus!oz