Wu Ivy writes:
> fprintf(fp, (i == tupdesc->natts) ? "%s\n" : "%s," ,
> SPI_getvalue(tuple, tupdesc, i));
That (specifically the SPI_getvalue call) is what's leaking memory.
You could improve matters by pfree'ing the result string after each
such call.
Just to add insult t
Hi all,
I’m creating a C extension to write data from the Postgres to a text file .
Since the table can be very large, I only want to process one chunk of data per
time to keep the memory stable. To achieve this, I use SPI
cursor(https://www.postgresql.org/docs/current/static/spi-spi-cursor-f