|
|
|
|
|
by mannykannot
2311 days ago
|
|
I think you are conflating two issues: while one should understand who owns what and for how long, it does not follow that one should always free resources even when it is not necessary, if doing so adds complexity and therefore more things to go wrong, or if it makes things slower than optimal. In this particular case, correctness was not primarily assured by a massive amount of testing (though that may have been done), but by a rigorous static analysis. |
|
In postgres memory contexts are used extensively to manage allocations. And in quite few places we intentionally don't do individual frees, but reset the context as a whole (freeing the memory). Obviously only where the total amount of memory is limited...