pg_walinspect memory leaks - Mailing list pgsql-hackers

From Peter Geoghegan
Subject pg_walinspect memory leaks
Date
Msg-id CAH2-WznLEJjn7ghmKOABOEZYuJvkTk=GKU3m0+-XBAH+erPiJQ@mail.gmail.com
Whole thread Raw
Responses Re: pg_walinspect memory leaks
List pgsql-hackers
It looks like pg_walinspect's GetWALRecordsInfo() routine doesn't take
sufficient care with memory management. It should avoid memory leaks
of the kind that lead to OOMs whenever
pg_get_wal_records_info_till_end_of_wal() has to return very many
tuples. Right now it isn't that hard to make that happen, even on a
system where memory is plentiful. I wasn't expecting that, because all
of these functions use a tuplestore.

More concretely, it looks like GetWALRecordInfo() calls
CStringGetTextDatum/cstring_to_text in a way that accumulates way too
much memory in ExprContext. This could be avoided by using a separate
memory context that is reset periodically, or something else along the
same lines.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: recovery modules
Next
From: Jacob Champion
Date:
Subject: [PATCH] Fix unbounded authentication exchanges during PQconnectPoll()