Tom Lane wrote:
Thomas Hallgren <[EMAIL PROTECTED]> writes:
As it turns out, I'm not supposed to allocate the returned tuple in the caller context.

Where do you get that from?  plpgsql and plperl both do it that way AFAICS.

Are you testing in an --enable-cassert build?  The memory-clobber
behavior that that turns on is really essential for finding
dangling-pointer problems ...


I use --enable-cassert. I don't think my problem is a dangling pointer.

I just created a dummy C-function that short circuits the java_call_handler. It calls my real java function with the correct parameters. When I register this function with language C and use it instead of the normal function that calls via the java call handler, there's no memory leak. It only leaks memory when I go through the call handler. The call handler doesn't execute many lines of code and from what I can tell, it doesn't manipulate contexts at all. Nor does it allocate anything. Further more, I can prevent the leak by allocating the returned tuple in a context of my own and free it on the next call.

Is there a difference in how the executor treat a C function and a function using a call handler that can cause this behavior?

Regards,
Thomas Hallgren


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to