You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2022/10/06 01:56:31 UTC

[doris] branch master updated: [fix](string) allocate memory according to actual size instead of max size (#13112)

This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 218b0857ab [fix](string) allocate memory according to actual size instead of max size (#13112)
218b0857ab is described below

commit 218b0857ab65c3178a304c9cc4484dad589137d9
Author: Yongqiang YANG <98...@users.noreply.github.com>
AuthorDate: Thu Oct 6 09:56:22 2022 +0800

    [fix](string) allocate memory according to actual size instead of max size (#13112)
    
    String column lengh is 2GB, if we allocate memory according to column length,
    string would consume a lot of memory. It also misleads memory tracker.
---
 be/src/olap/wrapper_field.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/be/src/olap/wrapper_field.cpp b/be/src/olap/wrapper_field.cpp
index afef2b47a5..3e3a4e9c62 100644
--- a/be/src/olap/wrapper_field.cpp
+++ b/be/src/olap/wrapper_field.cpp
@@ -52,11 +52,7 @@ WrapperField* WrapperField::create(const TabletColumn& column, uint32_t len) {
         variable_len =
                 std::max(len, static_cast<uint32_t>(column.length() - sizeof(VarcharLengthType)));
     } else if (column.type() == OLAP_FIELD_TYPE_STRING) {
-        // column.length is the serialized varchar length
-        // the first sizeof(StringLengthType) bytes is the length of varchar
-        // variable_len is the real length of varchar
-        variable_len =
-                std::max(len, static_cast<uint32_t>(column.length() - sizeof(StringLengthType)));
+        variable_len = len;
     } else {
         variable_len = column.length();
     }


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