summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-04-12 14:28:57 -0600
committerKarl Williamson <khw@cpan.org>2016-05-24 10:28:38 -0600
commit6ddd902ce7b4052f3d48e6dd638d08d705d1ee16 (patch)
tree0e10bb914d9586e241540e72b43133eb20fc81c1 /locale.c
parent58eebef2d34f0f429943dd0ab07bead821d9daac (diff)
downloadperl-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/locale.c b/locale.c
index 9414eb419e..48b918429e 100644
--- a/locale.c
+++ b/locale.c
@@ -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