BuildTupleFromCStrings Memory Documentation?

From: Jason Petersen <jason(at)citusdata(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: BuildTupleFromCStrings Memory Documentation?
Date: 2015-05-01 01:02:16
Message-ID: 89951D0E-9628-4C3A-ABFD-1B6CB00FF4BE@citusdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Within the core codebase, BuildTupleFromCStrings is often called within a temporary memory context cleared after the call. In dblink.c, this is justified as being needed to “[clean up] not only the data we have direct access to, but any cruft the I/O functions might leak”.

I wrote a pretty minimal case to call BuildTupleFromCStrings in a loop (attached) and found that I was using 40GB of RAM in a few minutes, though I was not allocating any memory myself and immediately freed the tuple it returned.

Is the need to wrap this call in a protective context documented anywhere? Portions of the documentation use BuildTupleFromCStrings in examples without mentioning this precaution. Is it just well-known, or did I miss a README or comment somewhere?

--
Jason Petersen
Software Engineer | Citus Data
303.736.9255
jason(at)citusdata(dot)com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christian Ullrich 2015-05-01 01:09:31 Re: transforms vs. CLOBBER_CACHE_ALWAYS
Previous Message Kohei KaiGai 2015-05-01 00:52:47 Re: One question about security label command