Re: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-26 Thread Nathan Kerr
Read Ways to limit concurrent resource use for different methods that can be used to limit concurrency along with example code. On Wednesday, October 25, 2017 at 9:05:44 PM UTC+2, Tamás Gulácsi wrote: > > Just blind shots: > resp.Body.Close(), >

Re: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread Michael Jones
Rob, perhaps it is not clear to you that what you describe is not a memory leak. Imagine this: Rob to car wash robot: "Robot, Wash each car in the parking lot, one after another" Robot #1: OK Rob to parking lot robot: "Robot, Park a million cars in the parking lot" Robot #2: OK. Rob: "OMG! We

RE: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread Tamás Gulácsi
Just blind shots: resp.Body.Close(), sync.Pool the buffers, Limit concurrency - the simplest is a make(chan struct{}, 512) ans push/pull empry tokens to it. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

RE: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread 'Rob Archibald' via golang-nuts
] Memory leak when calling highly parallel goroutines On Wed, Oct 25, 2017 at 10:21 AM, Rob Archibald <r...@robarchibald.com> wrote: > > It is a memory leak because the memory continues to grow for as long > as the loop continues to run. If you change the code example I gave to >

Re: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread Ian Lance Taylor
On Wed, Oct 25, 2017 at 10:21 AM, Rob Archibald wrote: > > It is a memory leak because the memory continues to grow for as long as the > loop continues to run. If you change the code example I gave to an infinite > loop you'll see that it grows infinitely. I had it stop at

Re: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread 'Rob Archibald' via golang-nuts
Thanks Ian, It is a memory leak because the memory continues to grow for as long as the loop continues to run. If you change the code example I gave to an infinite loop you'll see that it grows infinitely. I had it stop at 1000 for demonstration purposes because each scan request that my

Re: [go-nuts] Memory leak when calling highly parallel goroutines

2017-10-25 Thread Ian Lance Taylor
On Wed, Oct 25, 2017 at 12:06 AM, wrote: > > I've got a nasty memory leak. It appears that Go won't reclaim memory when > goroutines are called in a highly parallel fashion. > > To illustrate the issue I've written a simple example below. When I run this > on my