[ 
https://issues.apache.org/jira/browse/TRAFODION-2326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15633735#comment-15633735
 ] 

ASF GitHub Bot commented on TRAFODION-2326:
-------------------------------------------

Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/815#discussion_r86410177
  
    --- Diff: core/sql/executor/ex_sort.cpp ---
    @@ -330,21 +364,39 @@ ExSortTcb::~ExSortTcb()
        nfDiags_ = NULL;
       
       freeResources();
    -  
    -  if(pool_)
    -    delete pool_;
    +
     };
       
     ////////////////////////////////////////////////////////////////////////
     // Free Resources
     //
     void ExSortTcb::freeResources()
     {
    -  if (sortPool_)
    +  if (partialSortPool_)
    +  {
    +    delete partialSortPool_;
    +    partialSortPool_ = NULL;
    +  }
    +  if (regularSortPool_)
    +  {
    +    delete regularSortPool_;
    +    regularSortPool_ = NULL;
    +  }
    +  if (topNSortPool_)
    +  {
    +    delete topNSortPool_;
    +    topNSortPool_ = NULL;
    +  }
    +  if (sortPool_ && (sortPool_ != receivePool_))
    --- End diff --
    
    What if sortPool_ is not null and  sortPool_ == receivePool_? Shouldn't we 
set it to NULL in this case (without doing a delete)?


> TopN sort consumes more memory than needed.
> -------------------------------------------
>
>                 Key: TRAFODION-2326
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2326
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-exe
>    Affects Versions: 2.1-incubating
>            Reporter: Prashanth Vasudev
>            Assignee: Prashanth Vasudev
>
> Records that get discarded , those that do not belong to TopN rows, release 
> reference to the tupp descriptor, however the released tuple memory does not 
> get reused for new records from child nodes. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to