Hello, Another colleague provided a report of memory leak, during a GIN index build. Test case to reproduce the attached (need to create a gin index on the val column after loading). Sorry, it generates a 24GB table, and memory start leaking with a 1GB maintenance_work_mem after reaching 8 or 9 times the m_w_m setting, leading to ~ 9GB used in Gin build temporary context.
After some digging, the leak comes from walbufbegin palloc in registerLeafRecompressWALData(). IIUC, walbufbegin isn't pfree-d and can't be before XLogInsert() is called, which happens in ginPlaceToPage(). I don't see a simple way to fix that. My first idea would be to change GinBtreeData's placeToPage (and all other needed) functions signature to pass a pointer to pfree in ginPlaceToPage() if needed, but it doesn't really seem appealing. In any case, I'd be happy to work on a patch if needed. Also, in dataPlaceToPageLeaf() and ginVacuumPostingTreeLeaf(), shouldn't the START_CRIT_SECTION() calls be placed before the xlog code? Regards. -- Julien Rouhaud http://dalibo.com - http://dalibo.org
Description: Perl program
-- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers