Skip to content

Commit

Permalink
manual garbage collection
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalcaliskan committed Jan 3, 2022
1 parent a1c96a2 commit ca6be55
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/raw/raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package raw
import (
"context"
"math/rand"
"runtime"
"runtime/debug"
"testing"
"time"
)

func TestStartFlooding(t *testing.T) {
debug.SetGCPercent(-1)
srcIps := getIps()
srcPorts := getPorts()
macAddrs := getMacAddrs()
Expand Down Expand Up @@ -52,8 +55,10 @@ func TestStartFlooding(t *testing.T) {
case <-ctx.Done():
cancel()
t.Logf("context closed, caseName=%s, floodType=%s, floodMilliSeconds=%d\n", tc.name, tc.floodType, tc.floodMilliSeconds)
runtime.GC()
case <-time.After(120 * time.Second):
t.Log("overslept")
runtime.GC()
}
})
}
Expand Down

0 comments on commit ca6be55

Please sign in to comment.