| From: | Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> |
|---|---|
| To: | Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru> |
| Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru> |
| Subject: | Re: Jsonb transform for pl/python |
| Date: | 2018-09-27 14:58:22 |
| Message-ID: | b14b08f2-6598-b386-46f7-cd577383d54f@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Working on the new lazy transform for jsonb I found another memory leak in
PLyObject_ToJsonbValue(): palloc() for output boolean JsonbValue is unnecessary,
'out' variable is already initialized.
Fix is attached.
On 15.06.2018 14:42, Alexander Korotkov wrote:
> Hi!
>
> On Fri, Jun 15, 2018 at 2:11 PM Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> wrote:
>
> I found a memory leak in PLySequence_ToJsonbValue():
> PyObject returned from PySequence_GetItem() is not released.
>
> A bug can be easily reproduced using function roudtrip() from regression test:
> SELECT roundtrip('[1,2,3]'::jsonb) FROM generate_series(1, 1000000);
>
> Similar code in PLyMapping_ToJsonbValue() seems to be correct because
> PyList_GetItem() and PyTuple_GetItem() return a borrowed reference.
>
> Patch with fix is attached.
> I'm going to check and commit this if everything is OK.
>
> ------
> Alexander Korotkov
> Postgres Professional: http://www.postgrespro.com
> The Russian Postgres Company
--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-memory-leak-in-PLyObject_ToJsonbValue.patch | text/x-patch | 774 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2018-09-27 15:23:49 | pgsql: Build src/port files as a library with -fPIC, and use that in li |
| Previous Message | Jesper Pedersen | 2018-09-27 14:24:46 | Re: executor relation handling |