davecgh / go-spew

Implements a deep pretty printer for Go data structures to aid in debugging
ISC License
5.98k stars 361 forks source link

spew fails to detect cyclic data #66

Open cpcallen opened 7 years ago

cpcallen commented 7 years ago

The following runs forever(*) without producing any output:

package main

import "github.com/davecgh/go-spew/spew"

func main() {
    type loop *loop
    var loop1, loop2 loop
    loop1 = &loop2
    loop2 = &loop1
    spew.Dump(&loop1)
}

(*) It does not hit the stack size limit; its memory usage does keep growing so obviously it will eventually run out of swap or virtual address space...

dmitshur commented 7 years ago

53 is possibly related.

cpcallen commented 7 years ago

I was going to say there was no interface values involved here, but of course the param to Dump is itself of interface type. So yes: entirely possible that this is related.