- Notifications
You must be signed in to change notification settings - Fork5
Commitd062245
committed
Improve memory management for PL/Tcl functions.
Formerly, the memory used to represent a PL/Tcl function was allocated withmalloc() or in TopMemoryContext, and we'd leak it all if the function gotredefined during the session. Instead, create a per-function context andkeep everything in or under that context. Add a reference-countingmechanism (like the one plpgsql has long had) so that we can safely cleanup an old function definition, either immediately if it's not beingexecuted or at the end of the outermost execution.Currently, we only detect that a cached function is obsolete when we nextattempt to call that function. So this covers the updated-definition casebut leaves cruft around after DROP FUNCTION. It's not clear whether it'sworth installing a syscache invalidation callback to watch for drops;none of the other PLs do, so for now we won't do it here either.Michael Paquier and Tom LaneDiscussion: <CAB7nPqSOyAsHC6jL24J1B+oK3p=yyNoFU0Vs_B6fd2kdd5g5WQ@mail.gmail.com>1 parent65a588b commitd062245
1 file changed
+144
-116
lines changed0 commit comments
Comments
(0)