pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Repair memory leaks in plpython.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/29dfffae0a6db6cb880ae873169f5512ddab703d

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++-----------------
src/pl/plpython/plpy_planobject.c   |  1 -
src/pl/plpython/plpy_planobject.h   |  1 -
src/pl/plpython/plpy_spi.c          | 59 ++++++++++++++++---------------------
4 files changed, 49 insertions(+), 64 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e98df02df3f2463771b0f008832023cc609c49b2

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++------------------
src/pl/plpython/plpy_spi.c          | 58 ++++++++++++++++---------------------
2 files changed, 49 insertions(+), 61 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/33a4e656dc10b3cb9023bccdc0a12dc604613195

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++------------------
src/pl/plpython/plpy_spi.c          | 58 ++++++++++++++++---------------------
2 files changed, 49 insertions(+), 61 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/71bb9c4b2a1425877e0ef2a983bb855c6ce7bffc

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++------------------
src/pl/plpython/plpy_spi.c          | 58 ++++++++++++++++---------------------
2 files changed, 49 insertions(+), 61 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bcb4db0d379f39a913c8c38d5c6ca5006435be7a

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++------------------
src/pl/plpython/plpy_spi.c          | 58 ++++++++++++++++---------------------
2 files changed, 49 insertions(+), 61 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Repair memory leaks in plpython.
@ 2025-01-11 16:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2025-01-11 16:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Repair memory leaks in plpython.

PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/02a38bc84befa2858fbff65fd9cb46b640d5abd2

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 52 +++++++++++++++------------------
src/pl/plpython/plpy_spi.c          | 58 ++++++++++++++++---------------------
2 files changed, 49 insertions(+), 61 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2025-01-11 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>
2025-01-11 16:46 pgsql: Repair memory leaks in plpython. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox