Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

nodeFunctionscan.c

Blame
    • Neil Conway's avatar
      ff428cde
      Fix several memory leaks when rescanning SRFs. Arrange for an SRF's · ff428cde
      Neil Conway authored
      "multi_call_ctx" to be a distinct sub-context of the EState's per-query
      context, and delete the multi_call_ctx as soon as the SRF finishes
      execution. This avoids leaking SRF memory until the end of the current
      query, which is particularly egregious when the SRF is scanned
      multiple times. This change also fixes a leak of the fields of the
      AttInMetadata struct in shutdown_MultiFuncCall().
      
      Also fix a leak of the SRF result TupleDesc when rescanning a
      FunctionScan node. The TupleDesc is allocated in the per-query context
      for every call to ExecMakeTableFunctionResult(), so we should free it
      after calling that function. Since the SRF might choose to return
      a non-expendable TupleDesc, we only free the TupleDesc if it is
      not being reference-counted.
      
      Backpatch to 8.3 and 8.2 stable branches.
      ff428cde
      History
      Fix several memory leaks when rescanning SRFs. Arrange for an SRF's
      Neil Conway authored
      "multi_call_ctx" to be a distinct sub-context of the EState's per-query
      context, and delete the multi_call_ctx as soon as the SRF finishes
      execution. This avoids leaking SRF memory until the end of the current
      query, which is particularly egregious when the SRF is scanned
      multiple times. This change also fixes a leak of the fields of the
      AttInMetadata struct in shutdown_MultiFuncCall().
      
      Also fix a leak of the SRF result TupleDesc when rescanning a
      FunctionScan node. The TupleDesc is allocated in the per-query context
      for every call to ExecMakeTableFunctionResult(), so we should free it
      after calling that function. Since the SRF might choose to return
      a non-expendable TupleDesc, we only free the TupleDesc if it is
      not being reference-counted.
      
      Backpatch to 8.3 and 8.2 stable branches.