You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: memory.go
    path of file: ./repos/gdu/pkg/analyze
    
    the code of the file until where you have to start completion: package analyze

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

	"github.com/pbnjay/memory"
	log "github.com/sirupsen/logrus"
)

// set GC percentage according to memory usage and system free memory
func manageMemoryUsage(c <-chan struct{}) {
	disabledGC := true

	for {
		select {
		case <-c:
			return
		d
    
func rebalanceGC(disabledGC *bool) {
	memStats := runtime.MemStats{}
	runtime.ReadMemStats(&memStats)
	free := memory.FreeMemory()

	// we use less memory than is free, disable GC
	if memStats.Alloc < free {
		if !*disabledGC {
			log.Printf(
				"disabling GC, alloc: %d, free: %d", memStats.Alloc, free,
			)
			debug.SetGCPercent(-1)
			*disabledGC = true
		}
	} else {
		// the more memory we use and the less memory is free, the more aggressive the GC will be
		gcPercent := int(100 / float64(memStats.Alloc) * float64(free))
		log.Printf(
			"setting GC percent to %d, alloc: %d, free: %d",
			gcPercent, memStats.Alloc, free,
		)
		debug.SetGCPercent(gcPercent)
		*disabledGC = false
	}
}