Skip to content

Commit

Permalink
Explicitly try and hand RAM back to the OS
Browse files Browse the repository at this point in the history
As part of the GC cycle, try and give RAM back to the OS.
  • Loading branch information
pboothe committed Dec 9, 2019
1 parent 315acc9 commit 921c5f7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demuxer/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package demuxer

import (
"context"
"runtime/debug"
"time"

"github.com/google/gopacket"
Expand Down Expand Up @@ -111,6 +112,8 @@ func (d *TCP) collectGarbage() {
close(s.UUIDchan)
close(s.Pchan)
}
// Tell the VM to try and return RAM to the OS.
debug.FreeOSMemory()
}(d.oldFlows)
// Record GC data.
d.status.GC(len(d.currentFlows), len(d.oldFlows))
Expand Down

0 comments on commit 921c5f7

Please sign in to comment.