diff options
author | Karl Williamson <khw@cpan.org> | 2016-04-12 14:28:57 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-05-24 10:28:38 -0600 |
commit | 6ddd902ce7b4052f3d48e6dd638d08d705d1ee16 (patch) | |
tree | 0e10bb914d9586e241540e72b43133eb20fc81c1 /locale.c | |
parent | 58eebef2d34f0f429943dd0ab07bead821d9daac (diff) | |
download | perl-6ddd902ce7b4052f3d48e6dd638d08d705d1ee16.tar.gz |
locale.c: Not so aggressive collation memory use guess
On platforms where strxfrm() is not well-behaved, and it fails because
it needs a larger buffer, prior to this commit, the size was doubled
before trying again. This could require a lot of memory on large
inputs. I'm uncomfortable with such a big delta on very large strings.
This commit changes it so it is not so aggressive. Note that this now
only gets called on platforms whose strxfrm() is not well behaved, and I
think the size prediction is better due to a recent commit, and there
isn't really much of a downside in not gobbling up memory so fast.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1782,7 +1782,7 @@ Perl__mem_collxfrm(pTHX_ const char *input_string, * isn't sufficient, they return the input size instead of * how much is needed.) * Increase the buffer size by a fixed percentage and try again. */ - xAlloc = (2 * xAlloc) + 1; + xAlloc += (xAlloc / 4) + 1; PL_strxfrm_is_behaved = FALSE; #ifdef DEBUGGING |