Skip site navigation (1) Skip section navigation (2)

ICU non-utf8 code path leaks memory like there's no tomorrow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: ICU non-utf8 code path leaks memory like there's no tomorrow
Date: 2017-06-23 01:36:38
Message-ID: 1955.1498181798@sss.pgh.pa.us (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
In a database with utf8 encoding, this behaves reasonably:

select count(*) from
(select * from generate_series(1,10000000) x
 order by x::text collate "en-x-icu") ss;

It eats circa 25MB, not a lot worse than the libc-collation equivalent.
But try it in say LATIN1, and it eats multiple gigabytes.

I believe the reason is that the code paths in varstr_cmp that make
use of icu_to_uchar() have forgotten to free the palloc'd output
of the latter.  I have not looked to see where else the users of
that and the reverse function made this mistake.

			regards, tom lane


pgsql-hackers by date

Next:From: Noah MischDate: 2017-06-23 01:43:00
Subject: Re: transition table behavior with inheritance appears broken
Previous:From: Amit LangoteDate: 2017-06-23 01:28:21
Subject: Re: Multi column range partition table

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group