-
Notifications
You must be signed in to change notification settings - Fork 169
[Bugfix]Fix memory leak & Improve buffer management #67
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
Conversation
| } else { | ||
| requestMemory(bufferSegmentSize); | ||
| WriterBuffer wb = new WriterBuffer(bufferSegmentSize); | ||
| wb.addRecord(serializedData, serializedDataLength); |
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.
For memory leak, how about:
int bufferSize = bufferSegmentSize
if (serializedDataLength > bufferSize) {
bufferSize = serializedDataLength
}
requestMemory(bufferSize);
WriterBuffer wb = new WriterBuffer(bufferSize);
..........
..........
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.
it's almost the same as my implementation, however if we use serializedDataLength as the construct parameter of WriterBuffer, the following record added to this partition will compare length with the first record serializedDataLength, that's not a elegant way
|
@summaryzb can you describe more detail about how to save memory for buffer management? |
|
If this is a bug fix, Could we add some cases ? |
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
============================================
- Coverage 56.41% 55.47% -0.95%
+ Complexity 1173 1098 -75
============================================
Files 149 140 -9
Lines 7968 7593 -375
Branches 761 731 -30
============================================
- Hits 4495 4212 -283
+ Misses 3231 3147 -84
+ Partials 242 234 -8 Help us with your feedback. Take ten seconds to tell us how you rate us. |
|
@summaryzb Do you want to continue pr? |
previously, we add |
yeah I'll move on this pr, sorry for reply not in time |
follow this suggesting |
follow this suggesting, 'Bug fix' and 'Improvement' is on the way |
|
fix memory leak:#145 |
I'll post the improvement pr after this pr merged |
|
Improvement of writer buffer to save memory:#157 |
What changes were proposed in this pull request?
the behavior of buffer management and memory allocate
1.when adding a huge record to a partition where the buffer is not initialized, we only allocate
bufferSegmentSizememory, however release the real huge size memory after the buffer is sent2.byte array will be fully used as possible to save memory
Why are the changes needed?
fix memory leak & improve buffer management
Does this PR introduce any user-facing change?
no
How was this patch tested?
pass testing