You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/03/26 07:28:04 UTC

[GitHub] [iotdb] tanhangbo opened a new issue #2919: C++ client 'class SessionDataSet' will memory leak

tanhangbo opened a new issue #2919:
URL: https://github.com/apache/iotdb/issues/2919


   通过valgrind检测,发现这里存在一些内存泄露,会导致时间久了爆内存
   
   ```
   ==20709== 576 bytes in 8 blocks are definitely lost in loss record 47 of 49
   ==20709==    at 0x4C3217F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ==20709==    by 0x4F36B12: SessionDataSet::constructOneRow() (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/lib/libiotdb_session.so)
   ==20709==    by 0x4F3676C: SessionDataSet::hasNext() (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/lib/libiotdb_session.so)
   ==20709==    by 0x120739: query1() (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   ==20709==    by 0x123B51: main (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   ==20709==
   
   
   ==20709== 1,218 (376 direct, 842 indirect) bytes in 1 blocks are definitely lost in loss record 48 of 49
   ==20709==    at 0x4C3217F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ==20709==    by 0x4F3CC71: Session::executeQueryStatement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/lib/libiotdb_session.so)
   ==20709==    by 0x120610: query1() (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   ==20709==    by 0x123B51: main (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   
   
   ==20709== 3,535 (376 direct, 3,159 indirect) bytes in 1 blocks are definitely lost in loss record 49 of 49
   ==20709==    at 0x4C3217F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ==20709==    by 0x4F3CC71: Session::executeQueryStatement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/lib/libiotdb_session.so)
   ==20709==    by 0x4F3C504: Session::checkTimeseriesExists(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/lib/libiotdb_session.so)
   ==20709==    by 0x120160: createTimeseries1() (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   ==20709==    by 0x123B47: main (in /home/tan/iotdb/client-cpp-0.12.0-SNAPSHOT-cpp-linux-x86_64/a.out)
   
   
   ```
   
   大概看了代码,SessionDataSet析构的时候并没有释放内存?


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

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



[GitHub] [iotdb] jixuan1989 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-814101042


   I do not see such a PR. @jamber001  welcome to fix it. :D


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

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



[GitHub] [iotdb] tanhangbo edited a comment on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo edited a comment on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812330425


   @jixuan1989  Thanks for your C++ work, C++ is so complicated so I just wait your team to fix. besides, there is
   another place causes memory leak(class SessionDataSet), this is a way to fix it, by add one line to class SessionDataSet :
   
   ```
       ~SessionDataSet(){ delete[] this->currentBitmap; }
   ```
   
   After checking the SessionDataSet, this issue can be closed.
   


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

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



[GitHub] [iotdb] jamber001 edited a comment on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jamber001 edited a comment on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-814077058


   > @jixuan1989 Thanks for your C++ work, C++ is so complicated so I just wait your team to fix. besides, there is
   > another place causes memory leak(class SessionDataSet), this is a way to fix it, by adding one line to class SessionDataSet :
   > 
   > ```
   >     ~SessionDataSet(){ delete[] this->currentBitmap; }
   > ```
   > 
   > After checking the SessionDataSet, this issue can be closed.
   
   @tanhangbo  Have you submit new fix to IoTDB for this issue?  If no, I will fix it.


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

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



[GitHub] [iotdb] tanhangbo removed a comment on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo removed a comment on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812330669


   After checking the SessionDataSet, this session can be closed.


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

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



[GitHub] [iotdb] tanhangbo commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812330669


   After checking the SessionDataSet, this session can be closed.


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

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



[GitHub] [iotdb] jixuan1989 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812275822


   @tanhangbo could you have a check again? If fixed, I will close this issue. 


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

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



[GitHub] [iotdb] wshao08 removed a comment on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
wshao08 removed a comment on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-809128540


   Hi @tanhangbo,
   I have submitted a PR to fix this memory bug. The return value of ```Session::executeQueryStatement()``` has been changed, so please modify your code and use the new version client. 
   
   If possible, would you please test the code using Valgrind again? Thanks!


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

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



[GitHub] [iotdb] github-actions[bot] commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-808019370


   Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!


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

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



[GitHub] [iotdb] tanhangbo commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812330425


   @jixuan1989  Thanks for your C++ work, C++ is so complicated so I just wait your team to fix. besides, there is
   another place causes memory leak(class SessionDataSet), this is a way to fix it, by add one line to class SessionDataSet :
   
   ```
       ~SessionDataSet(){ delete[] this->currentBitmap; }
   ```


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

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



[GitHub] [iotdb] tanhangbo closed issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo closed issue #2919:
URL: https://github.com/apache/iotdb/issues/2919


   


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

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



[GitHub] [iotdb] jamber001 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jamber001 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-814553794


   @jixuan1989  Thanks. I have created JIRA IOTDB-1282 for this.


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

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



[GitHub] [iotdb] jixuan1989 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-809012299


   Would you like to submit a PR to fix it?


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

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



[GitHub] [iotdb] jamber001 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
jamber001 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-814077058


   > @jixuan1989 Thanks for your C++ work, C++ is so complicated so I just wait your team to fix. besides, there is
   > another place causes memory leak(class SessionDataSet), this is a way to fix it, by adding one line to class SessionDataSet :
   > 
   > ```
   >     ~SessionDataSet(){ delete[] this->currentBitmap; }
   > ```
   > 
   > After checking the SessionDataSet, this issue can be closed.
   
   @tanhangbo  Have you submit new fix for this issue?  If no, I will fix it.


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

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



[GitHub] [iotdb] tanhangbo edited a comment on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
tanhangbo edited a comment on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-812330425


   @jixuan1989  Thanks for your C++ work, C++ is so complicated so I just wait your team to fix. besides, there is
   another place causes memory leak(class SessionDataSet), this is a way to fix it, by adding one line to class SessionDataSet :
   
   ```
       ~SessionDataSet(){ delete[] this->currentBitmap; }
   ```
   
   After checking the SessionDataSet, this issue can be closed.
   


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

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



[GitHub] [iotdb] wshao08 commented on issue #2919: C++ client 'class SessionDataSet' will memory leak

Posted by GitBox <gi...@apache.org>.
wshao08 commented on issue #2919:
URL: https://github.com/apache/iotdb/issues/2919#issuecomment-809128540


   Hi @tanhangbo,
   I have submitted a PR to fix this memory bug. The return value of ```Session::executeQueryStatement()``` has been changed, so please modify your code and use the new version client. 
   
   If possible, would you please test the code using Valgrind again? Thanks!


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

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