After some more testing I realized that v5 was leaking the xmlDocPtr. Now fixed in v6.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных