[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] posix: Remove alloca usage on regex build_trtable
From: |
Adhemerval Zanella |
Subject: |
Re: [PATCH 2/3] posix: Remove alloca usage on regex build_trtable |
Date: |
Mon, 11 Jan 2021 09:31:51 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 08/01/2021 19:30, Paul Eggert wrote:
> On 1/6/21 10:17 AM, Adhemerval Zanella wrote:
>> __libc_use_alloca/alloca is replaced with malloc regardless.
>
> These allocations are so small that they should be put on the stack instead
> of using malloc. I did that in Gnulib by installing the attached patch. The
> idea is that the resulting regexec.c file should be copyable unchanged into
> glibc.
>
> From a Gnulib point of view this code uses a 20 KiB frame (on a 64-bit host)
> which goes past the usual 4032-byte limit for stack frames, but I think we
> can stretch the point here. In glibc the limit is 64 KiB so there's no
> problem.
Right, I think we can maybe use scratch_buffer for these or even a dynamic array
with a more proper initial size as an improvement.