delve icon indicating copy to clipboard operation
delve copied to clipboard

Large core dumps generated on macos

Open derekparker opened this issue 2 years ago • 1 comments
trafficstars

  1. What version of Delve are you using (dlv version)?

Delve Debugger Version: 1.20.1 Build: cf65f947765f9ac7de28ca03e1090d080d8b92c0

  1. What version of Go are you using? (go version)?

go version go1.20.2 darwin/arm64

  1. What operating system and processor architecture are you using?

darwin/arm64

  1. What did you do?

Generated a core dump using the following program after continuing to main and nexting a few times:

package main

import (
	"fmt"
	"runtime"
	"strconv"
)

type Rectangle struct{}

func (r *Rectangle) Height() int {
	h, _ := strconv.ParseInt("7", 10, 0)
	return int(h)
}

func (r *Rectangle) Width() int {
	return 6
}

func (r *Rectangle) Area() int { return r.Height() * r.Width() }

func main() {
	var r Rectangle
	runtime.Breakpoint()
	fmt.Println(r.Area())
	fmt.Println(r.Area() * 2)
	fmt.Println(r.Area() * 3)
}

  1. What did you expect to see?

A reasonably sized core dump (for example, same program core dump generated on linux/amd64 is around 45M)

  1. What did you see instead?

A core dump generated that's 3.6G.

derekparker avatar Mar 16 '23 19:03 derekparker

We only skip things that are marked not readable, this might be a consequence of how the runtime allocates memory on macos. I don't know if we can do anything about it.

aarzilli avatar Mar 16 '23 19:03 aarzilli