You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "LemonLiTree (via GitHub)" <gi...@apache.org> on 2023/04/26 11:34:32 UTC

[GitHub] [doris] LemonLiTree opened a new pull request, #19116: [bug](fix)fix Geo memory leak

LemonLiTree opened a new pull request, #19116:
URL: https://github.com/apache/doris/pull/19116

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## 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] [doris] yiguolei commented on a diff in pull request #19116: [bug](fix)fix Geo memory leak

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #19116:
URL: https://github.com/apache/doris/pull/19116#discussion_r1177751220


##########
be/src/geo/wkb_parse.cpp:
##########
@@ -150,30 +150,30 @@ GeoShape* WkbParse::readGeometry(WkbParseContext* ctx) {
 
     uint32_t geometryType = (typeInt & 0xffff) % 1000;
 
-    GeoShape* shape;
+    std::unique_ptr<GeoShape> shape;
 
     switch (geometryType) {
     case wkbType::wkbPoint:
-        shape = readPoint(ctx);
+        shape.reset(readPoint(ctx));
         break;
     case wkbType::wkbLine:
-        shape = readLine(ctx);
+        shape.reset(readLine(ctx));
         break;
     case wkbType::wkbPolygon:
-        shape = readPolygon(ctx);
+        shape.reset(readPolygon(ctx));
         break;
     default:
         return nullptr;
     }
-    return shape;
+    return shape.release();

Review Comment:
   make  readGeometry method return std::unique_ptr<GeoShape>?



-- 
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] [doris] yiguolei merged pull request #19116: [bug](fix)fix Geo memory leak

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #19116:
URL: https://github.com/apache/doris/pull/19116


-- 
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] [doris] github-actions[bot] commented on a diff in pull request #19116: [bug](fix)fix Geo memory leak

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #19116:
URL: https://github.com/apache/doris/pull/19116#discussion_r1177953906


##########
be/src/geo/wkb_parse.h:
##########
@@ -41,14 +41,14 @@
 
     static WkbParseContext* read(std::istream& is, WkbParseContext* ctx);
 
-    static GeoShape* readGeometry(WkbParseContext* ctx);
+    static std::unique_ptr<GeoShape> readGeometry(WkbParseContext* ctx);
 
 private:
-    static GeoPoint* readPoint(WkbParseContext* ctx);
+    static std::unique_ptr<GeoPoint> readPoint(WkbParseContext* ctx);

Review Comment:
   warning: no template named 'unique_ptr' in namespace 'std' [clang-diagnostic-error]
   ```cpp
       static std::unique_ptr<GeoPoint> readPoint(WkbParseContext* ctx);
                   ^
   ```
   



##########
be/src/geo/wkb_parse.h:
##########
@@ -41,14 +41,14 @@ class WkbParse {
 
     static WkbParseContext* read(std::istream& is, WkbParseContext* ctx);
 
-    static GeoShape* readGeometry(WkbParseContext* ctx);
+    static std::unique_ptr<GeoShape> readGeometry(WkbParseContext* ctx);

Review Comment:
   warning: no template named 'unique_ptr' in namespace 'std' [clang-diagnostic-error]
   ```cpp
       static std::unique_ptr<GeoShape> readGeometry(WkbParseContext* ctx);
                   ^
   ```
   



##########
be/src/geo/wkb_parse.h:
##########
@@ -41,14 +41,14 @@
 
     static WkbParseContext* read(std::istream& is, WkbParseContext* ctx);
 
-    static GeoShape* readGeometry(WkbParseContext* ctx);
+    static std::unique_ptr<GeoShape> readGeometry(WkbParseContext* ctx);
 
 private:
-    static GeoPoint* readPoint(WkbParseContext* ctx);
+    static std::unique_ptr<GeoPoint> readPoint(WkbParseContext* ctx);
 
-    static GeoLine* readLine(WkbParseContext* ctx);
+    static std::unique_ptr<GeoLine> readLine(WkbParseContext* ctx);
 
-    static GeoPolygon* readPolygon(WkbParseContext* ctx);
+    static std::unique_ptr<GeoPolygon> readPolygon(WkbParseContext* ctx);

Review Comment:
   warning: no template named 'unique_ptr' in namespace 'std' [clang-diagnostic-error]
   ```cpp
       static std::unique_ptr<GeoPolygon> readPolygon(WkbParseContext* ctx);
                   ^
   ```
   



##########
be/src/geo/wkb_parse.h:
##########
@@ -41,14 +41,14 @@
 
     static WkbParseContext* read(std::istream& is, WkbParseContext* ctx);
 
-    static GeoShape* readGeometry(WkbParseContext* ctx);
+    static std::unique_ptr<GeoShape> readGeometry(WkbParseContext* ctx);
 
 private:
-    static GeoPoint* readPoint(WkbParseContext* ctx);
+    static std::unique_ptr<GeoPoint> readPoint(WkbParseContext* ctx);
 
-    static GeoLine* readLine(WkbParseContext* ctx);
+    static std::unique_ptr<GeoLine> readLine(WkbParseContext* ctx);

Review Comment:
   warning: no template named 'unique_ptr' in namespace 'std' [clang-diagnostic-error]
   ```cpp
       static std::unique_ptr<GeoLine> readLine(WkbParseContext* ctx);
                   ^
   ```
   



-- 
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] [doris] yiguolei commented on a diff in pull request #19116: [bug](fix)fix Geo memory leak

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #19116:
URL: https://github.com/apache/doris/pull/19116#discussion_r1177751885


##########
be/src/geo/wkb_parse.cpp:
##########
@@ -204,10 +204,10 @@ GeoPolygon* WkbParse::readPolygon(WkbParseContext* ctx) {
         coordss.add(coords);
     }
 
-    GeoPolygon* polygon = new GeoPolygon();
+    std::unique_ptr<GeoPolygon> polygon = GeoPolygon::create_unique();
 
     if (polygon->from_coords(coordss) == GEO_PARSE_OK) {
-        return polygon;
+        return polygon.release();

Review Comment:
   and here, return std::unique_ptr<GeoPolygon>?



##########
be/src/geo/wkb_parse.cpp:
##########
@@ -150,30 +150,30 @@ GeoShape* WkbParse::readGeometry(WkbParseContext* ctx) {
 
     uint32_t geometryType = (typeInt & 0xffff) % 1000;
 
-    GeoShape* shape;
+    std::unique_ptr<GeoShape> shape;
 
     switch (geometryType) {
     case wkbType::wkbPoint:
-        shape = readPoint(ctx);
+        shape.reset(readPoint(ctx));
         break;
     case wkbType::wkbLine:
-        shape = readLine(ctx);
+        shape.reset(readLine(ctx));
         break;
     case wkbType::wkbPolygon:
-        shape = readPolygon(ctx);
+        shape.reset(readPolygon(ctx));
         break;
     default:
         return nullptr;
     }
-    return shape;
+    return shape.release();
 }
 
 GeoPoint* WkbParse::readPoint(WkbParseContext* ctx) {
     GeoCoordinateList coords = WkbParse::readCoordinateList(1, ctx);
-    GeoPoint* point = new GeoPoint();
+    std::unique_ptr<GeoPoint> point = GeoPoint::create_unique();
 
     if (point->from_coord(coords.list[0]) == GEO_PARSE_OK) {
-        return point;
+        return point.release();

Review Comment:
   return std::unique_ptr<GeoPoint>?



-- 
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] [doris] LemonLiTree commented on pull request #19116: [bug](fix)fix Geo memory leak

Posted by "LemonLiTree (via GitHub)" <gi...@apache.org>.
LemonLiTree commented on PR #19116:
URL: https://github.com/apache/doris/pull/19116#issuecomment-1523652432

   run buildall


-- 
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] [doris] github-actions[bot] commented on pull request #19116: [bug](fix)fix Geo memory leak

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19116:
URL: https://github.com/apache/doris/pull/19116#issuecomment-1523278929

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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] [doris] github-actions[bot] commented on pull request #19116: [bug](fix)fix Geo memory leak

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19116:
URL: https://github.com/apache/doris/pull/19116#issuecomment-1523590328

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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