returnfmt.Errorf("failed to patch Go runtime.gcenable: %w",err)
}
case"runtime.MemProfileRate":
iferr:=st.GetMemory().SetMemoryRange(uint32(s.Value),bytes.NewReader(make([]byte,4)));err!=nil{// disable mem profiling, to avoid a lot of unnecessary floating point ops
returnerr
}
}
}
returnnil
}
// TODO(cp-903) Consider setting envar "GODEBUG=memprofilerate=0" for go programs to disable memprofiling
// TODO(cp-903) Consider setting envar "GODEBUG=memprofilerate=0" for go programs to disable memprofiling, instead of patching it out in PatchGo()