New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak in groot and add trace logs #2971
Conversation
Committed-by: siyuanzhang.zsy from Dev container
Committed-by: siyuanzhang.zsy from Dev container
interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs
Outdated
Show resolved
Hide resolved
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2971 +/- ##
==========================================
- Coverage 45.07% 42.37% -2.71%
==========================================
Files 99 99
Lines 10660 10649 -11
==========================================
- Hits 4805 4512 -293
- Misses 5855 6137 +282 see 15 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -49,7 +49,7 @@ impl Drop for EnginePortsResponse { | |||
fn drop(&mut self) { | |||
unsafe { | |||
if !self.errMsg.is_null() { | |||
CString::from_raw(self.errMsg as *mut c_char); | |||
drop(CString::from_raw(self.errMsg as *mut c_char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this unnecessary code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for fixing the warnings of compiler.
unsafe { | ||
Box::from_raw(ptr); | ||
drop(Box::from_raw(ptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop this unnecessary code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, if a point already been wrapped into a Rust struct, e.g. Box, or CString, they will be dropped automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There would be a warning like
warning: unused return value of `std::boxed::Box::<T>::from_raw` that must be used
--> /Users/runner/work/GraphScope/GraphScope/interactive_engine/executor/engine/pegasus/pegasus/src/communication/buffer.rs:121:13
|
121 | Box::from_raw(ptr.as_ptr());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
121 | let _ = Box::from_raw(ptr.as_ptr());
| +++++++
@@ -78,7 +78,7 @@ impl Drop for JnaResponse { | |||
fn drop(&mut self) { | |||
unsafe { | |||
if !self.errMsg.is_null() { | |||
CString::from_raw(self.errMsg as *mut c_char); | |||
drop(CString::from_raw(self.errMsg as *mut c_char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop() not necessary.
What do these changes do?
Related issue number
Fixes #2819