Joe Conway <[EMAIL PROTECTED]> writes: > Alvaro Herrera wrote: >> why is this a malloc() and not palloc()? And when/where/how is it freed?
> It isn't, at least not until the backend exits ;-) > This is how plpgsql is done throughout, pretty much. It's not so bad > when you remember that plpgsql functions are "compiled" once, and then > cached for future calls by the same backend. I think palloc would actually be wrong there, because it would allocate memory that would go away soon (certainly not later than end of transaction) whereas the structure needs to live as long as the plpgsql function cache entry does. Without a switch into a suitably-long-lived context, this code can't use palloc. > Having said that, however, I know Tom would like to see all of this > redone in the future, with palloc, and maybe a specific memory context > to ensure we don't leak memory when we don't want to. Yah. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]