Date: Tue, 13 Jun 95 21:52 MDT From: mat AT ardi DOT com (Mat Hostetter) To: r DOT grunwald AT cowan DOT edu DOT au Cc: kagel AT ts1 DOT bloomberg DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Malloc without malice 2 References: <5AEB520CA5 AT wasp DOT cs DOT cowan DOT edu DOT au> >>>>> "Ron" == Ron Grunwald writes: Ron> Doing around 1/2 million function calls to malloc(), isn't Ron> that a bit inefficient, considering the enourmous execution Ron> thread the system has to follow to allocate a single block of Ron> memory? Ron> Using the stack might be a much faster method as you only Ron> need 3 assembly language instructions for the same task. Ron didn't mention it, but "alloca" is the function to use when you want to quickly allocate space on the stack. There is no way to free such space; it is automatically freed on function exit at zero cost. For very large allocations, you should use malloc since stack space may be limited (isn't the default stack size something like 256K under djgpp V2?) Under V2 I've blown the stack with huge alloca's. -Mat