> As a general rule in threaded programs, avoid declaring local arrays
> or large structs.  Instead, malloc them and free them when you're done.
> A file server, as an example, should never allocate an 8K message
> buffer on the stack.  If you can manage to obey the rule of not having
> arrays on the stack (as local variables), you can usually comfortably
> make use of 4K or 8K stacks.

i've always followed this rule myself.  but it just occurs to me that
there might be another way of looking at this.

if our mythical program needs a fixed-size message buffer for every
request, there are advantages to the stack.  dynamic allocation
with the pool library is slow and single-threaded.  and of course,
any dynamic allocation is more work and can be fatal.

- erik

Reply via email to