Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Дата
Msg-id 3EF7F77D.4050409@joeconway.com
обсуждение исходный текст
Ответ на Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?  (Joe Conway <mail@joeconway.com>)
Ответы Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Joe Conway wrote:
> I get nanswers = 16777216, so right off the bat 67MB or so is allocated.
> Then there's this:
>
> <snippet>
>     /* compute the cross product from right to left */
>     for (;;)
>     {
>         oneres = (Oid *) palloc0(FUNC_MAX_ARGS * sizeof(Oid));
> </snippet>
>
> I'm guessing this gets executed nanswers times. I saw memory usage grow
> to 880 MB and then killed the process.
>
> I'm not sure of the best way to fix this yet, but I found that when
> calling the function with argument types matching the prototype
> perfectly, this code never gets executed.

Actually, adding a "pfree(oneres);" to the end of that for loop plugs
the memory leak and allows me to see the error message:

ERROR:  Function add_news__test(integer, character varying, timestamp
with time zone, character varying, character varying, character varying,
character varying, integer, timestamp with time zone, integer, timestamp
with time zone, character varying, character varying, character varying,
integer, boolean, character varying, character varying, character
varying, timestamp with time zone, integer, character varying, character
varying, integer) does not exist
         Unable to identify a function that satisfies the given argument
types
         You may need to add explicit typecasts

Takes a while to check all 16777216 possibilities though, so I'm still
not sure more isn't needed here.

Joe


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

Предыдущее
От: nolan@celery.tssi.com
Дата:
Сообщение: Re: [pgsql-advocacy] Documentation quality WAS: interesting PHP/MySQL thread
Следующее
От: culley harrelson
Дата:
Сообщение: Re: [pgsql-advocacy] interesting PHP/MySQL thread