Skip to content

Commit

Permalink
improved memory leak handling when deleting reference elements and ad…
Browse files Browse the repository at this point in the history
…ded more benchmarks
  • Loading branch information
feyeleanor committed Feb 23, 2013
1 parent 806cb99 commit 46d144e
Show file tree
Hide file tree
Showing 20 changed files with 539 additions and 138 deletions.
7 changes: 3 additions & 4 deletions complex128.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ func (s *C128Slice) Cut(i, j int) {
j = l
}
if j > i {
if m := l - (j - i); m > 0 && l > m {
copy(a[i:m], a[j:l])
*s = a[:m]
}
l -= j - i
copy(a[i:], a[j:])
*s = a[:l]
}
}

Expand Down
7 changes: 3 additions & 4 deletions complex64.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ func (s *C64Slice) Cut(i, j int) {
j = l
}
if j > i {
if m := l - (j - i); m > 0 && l > m {
copy(a[i:m], a[j:l])
*s = a[:m]
}
l -= j - i
copy(a[i:], a[j:])
*s = a[:l]
}
}

Expand Down
Loading

0 comments on commit 46d144e

Please sign in to comment.