Re: [go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-03 Thread djadala
On Friday, March 3, 2017 at 9:05:50 AM UTC+2, Yota Toyama wrote: > > Nathan, > > As I posted above right after you posted, you are right. > "Memory leak" was gone when I inserted sleep at the loop end. > Thank you for your advice! > > Yota > > On Friday, March 3, 2017 at 10:39:02 AM UTC+9, Nathan

Re: [go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-02 Thread Yota Toyama
Nathan, As I posted above right after you posted, you are right. "Memory leak" was gone when I inserted sleep at the loop end. Thank you for your advice! Yota On Friday, March 3, 2017 at 10:39:02 AM UTC+9, Nathan Fisher wrote: > > Hi Yota, > > I don't disagree there's value in understanding how

[go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-02 Thread Yota Toyama
Volker, Sorry for double posts. Following your idea, I could fix my code of the 2nd version. When I insert time.Sleep(SomeTime) at for loop end, everything seems to be fine. The threshold of SomeTime is between 100 and 1000. When it is set to 100, the memory usage grows over time but, when 1000,

Re: [go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-02 Thread Nathan Fisher
Hi Yota, I don't disagree there's value in understanding how Go handles the scenario. What I'm not certain of is the potential tradeoffs when optimising for an uncommon edge case. The loop you've created is very tight and would be unusual to find in a typical application. The allocator is moving

[go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-02 Thread Yota Toyama
Volker, I don't know if the term "memory leak" is misuse. But, the 1st version's memory usage is constant but the 2nd version's one grows over time as if nothing is garbage-collected. Yota On Friday, March 3, 2017 at 2:38:08 AM UTC+9, Volker Dobler wrote: > > Am Donnerstag, 2. März 2017 17:15:0

[go-nuts] Re: Understanding garbage collection in Go with infinite lists

2017-03-02 Thread Volker Dobler
Am Donnerstag, 2. März 2017 17:15:05 UTC+1 schrieb Yota Toyama: > > 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,