Chasing memory leaks in BCP [1] data load implementation in Babelfish [2]. Spotted unusually high RAM usage, decided to look deeper and got into a rabbit hole. Haven't had this fun of overnight debugging (of Postgres guts) for a long time. As a result found 4 different leaks and one (unlikely to be triggered) crash. And now have BCP data load impl with 100% constant-bounded RAM usage in a DB server process.
[1] https://learn.microsoft.com/en-us/sql/tools/bcp-utility?view... [2] https://babelfishpg.org/