Unless you’re using an extension, Postgres uses a process per connection model, which means that most of the memory is freed when the connection closes. I’m not saying that the memory contexts do or do not have memory leaks, but the process model will mask any issues pretty effectively.