Re: Question about MemoryContexts and functions that returns - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: Question about MemoryContexts and functions that returns
Date
Msg-id 44204B7F.1090005@tada.se
Whole thread Raw
In response to Question about MemoryContexts and functions that returns sets.  (Thomas Hallgren <thomas@tada.se>)
Responses Re: Question about MemoryContexts and functions that returns
List pgsql-hackers
David,
Thanks for the tip. A diff on the plperl source was really helpful.

As it turns out, I'm not supposed to allocate the returned tuple in the 
caller context. Apparently, PostgreSQL will always make a copy of it. I 
find this a bit inconsistent with how other return values are handled. 
PL/Java initially had some problems when I trusted that values where 
copied when in fact they where not. Has the function call semantics 
changed in this respect?

Kind Regards,
Thomas Hallgren

David Fetter wrote:
> On Mon, Mar 20, 2006 at 11:47:41AM +0100, Thomas Hallgren wrote:
>   
>> Hi,
>> A PL/Java user reports that his backend runs out of memory when he uses 
>> PL/Java to execute huge queries towards a remote database and return the 
>> result. PL/Java is designed not to collect data in memory when it 
>> returns result sets. Each call to the function handler will be 
>> dispatched to the corresponding 'ResultSet.next()' in order to retrieve 
>> and propagate one row at a time. Yet, it seems the data is collected 
>> somewhere. An excerpt from the user at the time he runs out of memory 
>> looks like this:
>>     
>
> A similar thing happened in PL/Perl up until recently.  Check Neil
> Conway's patches to that for hints :)
>
> Cheers,
> D
>   



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: qsort, once again
Next
From: "Gregory Maxwell"
Date:
Subject: [GENERAL] A real currency type