Another aspect of set_ps_display ()

Поиск
Список
Период
Сортировка
От Strong, David
Тема Another aspect of set_ps_display ()
Дата
Msg-id B6419AF36AC8524082E1BC17DA2506E80316D38C@USMV-EXCH2.na.uis.unisys.com
обсуждение исходный текст
Ответ на Re: Faster StrNCpy  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
We were just analyzing some more OProfile and ltrace data against
Postgres 8.2Beta1 and we noticed a number of calls as follows:


strlen("postgres: tpc tpc 192.168.1.200("...)    = 58
memset(0xbffff6b2, '\000', 2344)                 = 0xbffff6b2


We have tracked this down to the following code in the set_ps_display ()
function:


#ifdef PS_USE_CLOBBER_ARGV   {       int         buflen;
       /* pad unused memory */       buflen = strlen(ps_buffer);       MemSet(ps_buffer + buflen, PS_PADDING,
ps_buffer_size- buflen);   } 
#endif   /* PS_USE_CLOBBER_ARGV */


If set_ps_display () moves to use the strlcpy () function call, this
code might be redundant. Even if the StrNCpy () call is kept, this code
may still be redundant as StrNCpy () will zero fill the ps_buffer.

A MemSet () call on the ps_buffer has to be added to the init_ps_display
() function, if this code is removed to clear the buffer before use.

David


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PL/pgSQL Todo, better information in errcontext from plpgsql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Digging gram.y