From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Lars Kanis <kanis(at)comcard(dot)de> |
Subject: | Re: Retrieve memory size allocated by libpq |
Date: | 2018-09-12 04:11:20 |
Message-ID: | CAFj8pRAM16VBxO0h_4BpYNQt-g1Q=yRiTKhAgGrU=zTC=45VDw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2018-09-12 0:59 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > The implementation of PQresultMemsize is simple and correct.
>
> Hm, well, only for small values of "correct". A quick look at PQclear
> to see just what it clears shows that PGEvent objects associated with the
> PGresult were overlooked.
My mistake. I though so event data are independent.
> While that's not hard to fix (and I did so),
> there's a problem hiding behind that: we have no idea what sort of
> "instance data" the external event procedures may have associated with
> the PGresult. In principle, any space occupied by such data needs to
> be accounted for in this number.
>
> This isn't an issue if the event procedure takes the lazy man's approach
> of using PQresultAlloc to allocate such data. That's recommendable anyway
> since it saves having to write cleanup logic; and even if you don't do it
> like that, the space involved may be negligible. Still, I can foresee an
> eventual need to let event procedures adjust the result-size number,
> along the lines of PQincrementMemorySize(PGresult *res, size_t delta).
> But that can probably wait till somebody actually requests it.
>
> I didn't like the name "PQresultMemsize" much either, and changed it to
> "PQresultMemorySize", which seems more in keeping with naming and
> capitalization conventions elsewhere in libpq.
>
> Pushed with those and some cosmetic changes.
>
Thank you
Pavel
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2018-09-12 04:45:32 | Re: [HACKERS] Restricting maximum keep segments by repslots |
Previous Message | Michael Paquier | 2018-09-12 03:47:31 | Re: stat() on Windows might cause error if target file is larger than 4GB |