Commit 94b7e03b authored by mbaxter's avatar mbaxter Committed by GitHub

cannon: Undo changes to memprofile patching (#11420)

parent ca85dc42
......@@ -47,12 +47,16 @@ func PatchGo(f *elf.File, st mipsevm.FPVMState) error {
})); err != nil {
return fmt.Errorf("failed to patch Go runtime.gcenable: %w", err)
}
case "runtime.MemProfileRate":
if err := 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
return err
}
}
}
return nil
}
// 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()
func PatchStack(st mipsevm.FPVMState) error {
// setup stack pointer
sp := uint32(0x7f_ff_d0_00)
......
......@@ -2,7 +2,6 @@ package main
import (
"os"
"runtime"
"github.com/ethereum/go-ethereum/log"
......@@ -10,13 +9,6 @@ import (
oplog "github.com/ethereum-optimism/optimism/op-service/log"
)
var _ = func() bool {
// Disable mem profiling, to avoid a lot of unnecessary floating point ops
// TODO(cp-903) Consider cutting this in favor patching envar "GODEBUG=memprofilerate=0" into cannon go programs
runtime.MemProfileRate = 0
return true
}()
func main() {
// Default to a machine parsable but relatively human friendly log format.
// Don't do anything fancy to detect if color output is supported.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment