Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)
Дата
Msg-id 27894.1312906576@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> On 09.08.2011 18:04, Alvaro Herrera wrote:
>> I think I vaguely remember that the reason for doing it this way is that
>> the copy into the relcache worked, i.e. if the originals went away,
>> there was no dangling pointer.  Did you test this?

> These strings are never freed, so I don't think it's possible to end up 
> with a dangling pointer.

Well, in that case the relevant question is whether we need to worry
about memory leaks due to multiple copies.

Personally I'm wondering why the function is strdup'ing the default
value at all.  In practice, wouldn't it practically always be a compile
time constant string?  Why create possible issues by designing the code
for a different use-case?  In particular, why not declare the default
value as "const char *" and specify that it's caller's responsibility
that it live forever if it's not just a constant string?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Enforcing that all WAL has been replayed after restoring from backup
Следующее
От: Tom Lane
Дата:
Сообщение: Re: plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https