I'm have memory leak in this function but i don't know where. func CheckProxySOCKS(prox string, c chan QR) (err error) {
//Sending request through proxy dialer, _ := proxy.SOCKS5("tcp", prox, nil, proxy.Direct) timeout := time.Duration(5 * time.Second) httpClient := &http.Client{Timeout: timeout, Transport: &http.Transport{ Dial: dialer.Dial}} res, err := httpClient.Get("https://api.ipify.org?format=json") if err != nil { c <- QR{Addr: prox, Res: false} return } _, err = ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { return } c <- QR{Addr: prox, Res: true} return } Here i called it for _, proxy := range splitedProxies { go code.CheckProxySOCKS(proxy, respChan) } for range splitedProxies { r := <-respChan if r.Res { checkedProxiesArray = append(checkedProxiesArray, r.Addr) } } After 3-4 cycle i'v got more than 40k goroutines(i'v check it by runtime.NumGoroutine()). After start app used around 100mb after 4 cycle more than 1GB Github <https://github.com/trigun117/ProxyGrabber> repo with all code -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.