Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

[严重] xfmt对某些结构体必现OOM #2

Closed
gogokit opened this issue Sep 18, 2021 · 1 comment
Closed

[严重] xfmt对某些结构体必现OOM #2

gogokit opened this issue Sep 18, 2021 · 1 comment

Comments

@gogokit
Copy link

gogokit commented Sep 18, 2021

对于下面的代码xfmt必现OOM

package main

import (
	"github.com/mix-go/xfmt"
)

func main() {
	type MyStruct struct {
		slice []MyStruct
		str   string
	}

	var s MyStruct
	for i := 1; i <= 10; i++ {
		s.slice = append(s.slice, MyStruct{})
	}

	slice2 := s.slice
	slice2 = append(slice2, MyStruct{str: ""})

	s.slice[0].slice = slice2
	xfmt.Println(s.slice)
}

异常信息:

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0200e0348 stack=[0xc0200e0000, 0xc0400e0000]
fatal error: stack overflow
@onanying
Copy link
Member

onanying commented Sep 18, 2021

@58kg 套娃交叉引用导致,你可以用 xfmt:"-" 忽略这个字段

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants