Retrieve memory size allocated by libpq

From: Lars Kanis <lars(at)greiz-reinsdorf(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Sam Saffron <sam(dot)saffron(at)gmail(dot)com>
Subject: Retrieve memory size allocated by libpq
Date: 2018-06-23 19:58:43
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I would like to be able to retrieve the size of memory internally
allocated by libpq for a result. The reason is that we have a Ruby
wrapper that exposes libpq in Ruby. The problem is that Ruby's GC
doesn't know how much memory has been allocated by libpq, so no pressure
is applied to the GC when it should be. With this function we could
instruct the GC about the memory usage associated to each result object.

This issue has already been discussed in the following thread, with the
request to use custom malloc/realloc/free functions:

Retrieving the allocated memory size is another approach to solve the
same base issue. However since the relation between memory consumption
and the particular result object is maintained, it can additionally be
used to provide diagnostic information to each object.

What do you think about adding such a function?

Kind Regards,

Attachment Content-Type Size
0001-libpq-Add-function-PQresultMemsize.patch text/x-patch 4.3 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-06-23 20:08:21 Re: Log query parameters for terminated execute
Previous Message Sergei Kornilov 2018-06-23 19:54:19 Log query parameters for terminated execute