[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] alloca

From: Paul Eggert
Subject: Re: [Bug-gnulib] alloca
Date: 12 Nov 2003 12:11:23 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> writes:

>   2) If you want to avoid segmentation fault due to alloca of large chunks,
>      and allocation speed is still important, then use a hybrid approach:
>      alloca() for small sizes and xmalloc() for larger ones.
> You can find a C++ example for the approach (2) in the appended file, taken
> from CLN. In C it's less pretty.

Thanks for mentioning that code, as I'm interested in the same subject.
A couple of questions, if you have the time:

* Is there a good heuristic for determining the maximum safe argument
  to give to alloca?  For example, if the machine's page size is 8192
  bytes and stacks are allocated on page boundaries, shouldn't
  alloca's argument be at most 8192 (or perhaps even 8191)?

  Ideally, I'd like to see this "maximum safe alloca" value
  automatically configured.

* Why is the code less pretty in C?  What general problems make it
  uglier in C?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]