Retrieve memory size allocated by libpq - Mailing list pgsql-hackers

From Lars Kanis
Subject Retrieve memory size allocated by libpq
Date
Msg-id fa16a288-9685-14f2-97c8-b8ac84365a4f@greiz-reinsdorf.de
Whole thread Raw
Responses Re: Retrieve memory size allocated by libpq
List pgsql-hackers
Hello,

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:

https://www.postgresql.org/message-id/flat/20170828172834.GA71455%40TC.local#20170828172834.GA71455@TC.local

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,
Lars


Attachment

pgsql-hackers by date:

Previous
From: Sergei Kornilov
Date:
Subject: Log query parameters for terminated execute
Next
From: Pavel Stehule
Date:
Subject: Re: Log query parameters for terminated execute