-
-
Notifications
You must be signed in to change notification settings - Fork 823
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: chunk memory leak, bug fix #491
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,6 +235,12 @@ func TestChunk(t *testing.T) { | |
allStrings := myStrings{"", "foo", "bar"} | ||
nonempty := Chunk(allStrings, 2) | ||
is.IsType(nonempty[0], allStrings, "type preserved") | ||
|
||
// appending to a chunk should not affect original array | ||
originalArray := []int{0, 1, 2, 3, 4, 5} | ||
result5 := Chunk(originalArray, 2) | ||
result5[0] = append(result5[0], 6) | ||
is.Equal(originalArray, []int{0, 1, 2, 3, 4, 5}) | ||
Comment on lines
+239
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So. it's not only a fix of a possible memory leak, but also a functional fix, no? I'm unsure why you are adding this check.no computer with me to check. My point is that the commit message could mention a memory leak fix + bug fix, maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, updated the title There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
} | ||
|
||
func TestPartitionBy(t *testing.T) { | ||
|
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.
I had never faced this notation, with the capacity apparently
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.
ref: https://stackoverflow.com/questions/12768744/re-slicing-slices-in-golang/18911267#18911267