Hi, all.
I'm trying to understand argument liveness in Go 1.8.
As preparation for it, I wrote 2 programs which iterate over infinite lists.
At first, I thought both can be run forever without any memory leak.
However, the result was that one could and the other couldn't.
Their main difference is the way to iterate lists.
l := *NewList(42, nil)
for {
l = *l.Rest() // Cause no memory leak :)
}
vs
l := NewList(42, nil)
for {
l = l.Rest() // Cause memory leak!!!
}
The repository is here <https://github.com/raviqqe/argument-liveness.go>.
I wanna understand why the latter causes memory leak and what is going on
in my programs at low level.
Any ideas?
Thank you.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.