Skip to content

Commit

Permalink
Tweak to alloc counting tests.
Browse files Browse the repository at this point in the history
I dearly wish this wasn't such a dark art.
But I really want these tests, too.
  • Loading branch information
warpfork committed Dec 1, 2020
1 parent 53fb23e commit ca68071
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions codec/codectools/scratch/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func TestReader(t *testing.T) {
// This is looks like one big nasty long walk, and so it is, but...
// the point is to test stateful interactions, so to write it this way is telling the truth.

// Force one more GC before we begin our accounting.
// (This doesn't really seem like it should be necessary, because indeed, memCheckpoint is also doing a forced GC;
// but empirically (at least as of go1.15), it is; flakey numbers for the very first test will result without this double-GC to prime things.)
runtime.GC()

// Fixed length short read should work.
memCheckpoint()
bs, err := r.Readnzc(4)
Expand Down

0 comments on commit ca68071

Please sign in to comment.