summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/libpq.sgml34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 5e7931ba901..06d909e8049 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -6387,6 +6387,32 @@ void *PQresultAlloc(PGresult *res, size_t nBytes);
</listitem>
</varlistentry>
+ <varlistentry id="libpq-pqresultmemorysize">
+ <term>
+ <function>PQresultMemorySize</function>
+ <indexterm>
+ <primary>PQresultMemorySize</primary>
+ </indexterm>
+ </term>
+
+ <listitem>
+ <para>
+ Retrieves the number of bytes allocated for
+ a <structname>PGresult</structname> object.
+<synopsis>
+size_t PQresultMemorySize(const PGresult *res);
+</synopsis>
+ </para>
+
+ <para>
+ This value is the sum of all <function>malloc</function> requests
+ associated with the <structname>PGresult</structname> object, that is,
+ all the space that will be freed by <function>PQclear</function>.
+ This information can be useful for managing memory consumption.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="libpq-pqlibversion">
<term>
<function>PQlibVersion</function>
@@ -6960,6 +6986,14 @@ void *PQinstanceData(const PGconn *conn, PGEventProc proc);
int PQresultSetInstanceData(PGresult *res, PGEventProc proc, void *data);
</synopsis>
</para>
+
+ <para>
+ Beware that any storage represented by <parameter>data</parameter>
+ will not be accounted for by <function>PQresultMemorySize</function>,
+ unless it is allocated using <function>PQresultAlloc</function>.
+ (Doing so is recommendable because it eliminates the need to free
+ such storage explicitly when the result is destroyed.)
+ </para>
</listitem>
</varlistentry>