Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it
От | Tom Lane |
---|---|
Тема | Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it |
Дата | |
Msg-id | 4451.1357687410@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: [PATCH 2/5] Make relpathbackend return a statically
result instead of palloc()'ing it
|
Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes: > And functions that return static buffers are evil incarnate. I've > spent way too much of my life dealing with the supreme idiocy that is > fmtId(). If someone ever finds a way to make that go away, I will buy > them a beverage of their choice at the next conference we're both at. Yeah, that was exactly the case that was top-of-mind when I was complaining about static return buffers upthread. It's not hard to make the ugliness go away: just let it strdup its return value. The problem is that in the vast majority of usages it wouldn't be convenient to free the result, so we'd have a good deal of memory leakage. What might be interesting is to instrument it to see how much (adding a counter to the function ought to be easy enough) and then find out whether it's an amount we still care about in 2013. Frankly, pg_dump is a memory hog already - a few more identifier-sized strings laying about might not matter anymore. (Wanders away wondering how many relpathbackend callers bother to free its result, and whether that matters either ...) regards, tom lane
В списке pgsql-hackers по дате отправления: