You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/14 00:51:46 UTC

[GitHub] [incubator-doris] GoGoWen opened a new pull request, #9560: fix memory leak

GoGoWen opened a new pull request, #9560:
URL: https://github.com/apache/incubator-doris/pull/9560

   # Proposed changes
   
       /// FunctionContexts for each registered expression. The FunctionContexts are created
       /// and owned by this VExprContext.
       std::vector<FunctionContext*> _fn_contexts;  
   
       _fn_contexts not be freed which cause memory leak.
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (Yes/No/I Don't know)
   2. Has unit tests been added: (Yes/No/No Need)
   3. Has document been added or modified: (Yes/No/No Need)
   4. Does it need to update dependencies: (Yes/No)
   5. Are there any changes that cannot be rolled back: (Yes/No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] GoGoWen commented on pull request #9560: fix memory leak

Posted by GitBox <gi...@apache.org>.
GoGoWen commented on PR #9560:
URL: https://github.com/apache/incubator-doris/pull/9560#issuecomment-1131621624

   as we use v1.0,   after verify with master branch.  the memory leak  should be fixed.  so close this pr.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei commented on a diff in pull request #9560: fix memory leak

Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #9560:
URL: https://github.com/apache/incubator-doris/pull/9560#discussion_r872909495


##########
be/src/vec/exprs/vexpr_context.cpp:
##########
@@ -30,6 +30,13 @@ VExprContext::VExprContext(VExpr* expr)
           _closed(false),
           _last_result_column_id(-1) {}
 
+VExprContext::~VExprContext() {
+    DCHECK(!_prepared || _closed);
+    for (int i = 0; i < _fn_contexts.size(); ++i) {
+        delete _fn_contexts[i];
+    }

Review Comment:
   Maybe we missed call close some where......



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei commented on a diff in pull request #9560: fix memory leak

Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #9560:
URL: https://github.com/apache/incubator-doris/pull/9560#discussion_r872909123


##########
be/src/vec/exprs/vexpr_context.cpp:
##########
@@ -30,6 +30,13 @@ VExprContext::VExprContext(VExpr* expr)
           _closed(false),
           _last_result_column_id(-1) {}
 
+VExprContext::~VExprContext() {
+    DCHECK(!_prepared || _closed);
+    for (int i = 0; i < _fn_contexts.size(); ++i) {
+        delete _fn_contexts[i];
+    }

Review Comment:
   Although this is a problem. But I do not think it is the root cause for your memory leak. Because 
   void VExprContext::close(doris::RuntimeState* state) {
       DCHECK(!_closed);
       FunctionContext::FunctionStateScope scope =
               _is_clone ? FunctionContext::THREAD_LOCAL : FunctionContext::FRAGMENT_LOCAL;
       _root->close(state, this, scope);
   
       for (int i = 0; i < _fn_contexts.size(); ++i) {
           _fn_contexts[i]->impl()->close();
           delete _fn_contexts[i];
       }
       // _pool can be NULL if Prepare() was never called
       if (_pool != NULL) {
           _pool->free_all();
       }
       _closed = true;
   }
   
   the close method will delete every _fn_contexts[i]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] GoGoWen closed pull request #9560: fix memory leak

Posted by GitBox <gi...@apache.org>.
GoGoWen closed pull request #9560: fix memory leak
URL: https://github.com/apache/incubator-doris/pull/9560


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org