| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrey Borodin <amborodin86(at)gmail(dot)com> |
| Subject: | Re: [PATCH] Add pretty-printed XML output option |
| Date: | 2025-05-21 20:20:17 |
| Message-ID: | 1358967.1747858817@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> writes:
> In my environment (libxml2 v2.9.10 and Ubuntu 22.04) I couldn't
> reproduce this memory leak.
Just when you thought it was safe to go back in the water ...
Experimenting with the improved valgrind leak detection code at [1],
I discovered that XMLSERIALIZE(... INDENT) has yet a different memory
leak problem. It turns out that xmlDocSetRootElement() doesn't
merely install the given root node: it unlinks the document's old
root node and returns it to you. If you don't free it, it's leaked
(for the session, since this is a malloc not palloc). The amount of
leakage isn't that large, seems to be a couple hundred bytes per
iteration, which may explain why this escaped our notice in the
previous testing. Still, it could add up under extensive usage.
So I think we need to apply the attached, back to PG 16.
regards, tom lane
[1] https://www.postgresql.org/message-id/1295385.1747847681%40sss.pgh.pa.us
| Attachment | Content-Type | Size |
|---|---|---|
| fix-leakage-in-xmlserialize-indent.patch | text/x-diff | 1.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2025-05-21 20:31:25 | [Util] Warn and Remove Invalid GUCs |
| Previous Message | Melanie Plageman | 2025-05-21 19:53:44 | Re: Log connection establishment timings |