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

From: Joe Conway <mail(at)joeconway(dot)com>
To:
Cc: reuven(at)lerner(dot)co(dot)il, pgsql-general(at)postgresql(dot)org, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Date: 2003-06-24 07:02:21
Message-ID: 3EF7F77D.4050409@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nolan 2003-06-24 07:05:23 Re: [GENERAL] Documentation quality WAS: interesting PHP/MySQL thread
Previous Message Reuven M. Lerner 2003-06-24 06:56:19 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2003-06-24 07:08:29 Re: interval's and printing...
Previous Message Reuven M. Lerner 2003-06-24 06:56:19 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?

Browse pgsql-patches by date

  From Date Subject
Next Message Devrim GUNDUZ 2003-06-24 10:45:39 .pot files are unavailable (?)
Previous Message Reuven M. Lerner 2003-06-24 06:56:19 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?