We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多次请求通过top能发现RES占用内存轻微持续上升,go1.4,linux 64,代码如下: package main
import ( "fmt" curl "github.com/andelf/go-curl" )
func main() { fooTest := func(buf []byte, userdata interface{}) bool { //println("DEBUG: size=>", len(buf)) //println("DEBUG: content=>", string(buf)) return true } easy := curl.EasyInit() defer easy.Cleanup() for i := 0; i < 1000000; i++ { easy.Setopt(curl.OPT_URL, "http://192.168.1.3/") easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest) if err := easy.Perform(); err != nil { fmt.Printf("ERROR: %v\n", err) } } } 协程下同样如此: package main
import ( "fmt" curl "github.com/andelf/go-curl" "sync" )
func main() { var wg sync.WaitGroup var limit = make(chan struct{}, 200) fooTest := func(buf []byte, userdata interface{}) bool { //println("DEBUG: size=>", len(buf)) //println("DEBUG: content=>", string(buf)) return true } for i := 0; i < 1000000; i++ { limit <- struct{}{} wg.Add(1) go func() { easy := curl.EasyInit() defer easy.Cleanup() easy.Setopt(curl.OPT_URL, "http://192.168.1.3/") easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)
if err := easy.Perform(); err != nil { fmt.Printf("ERROR: %v\n", err) } <-limit defer wg.Done() }() wg.Wait() }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
多次请求通过top能发现RES占用内存轻微持续上升,go1.4,linux 64,代码如下:
package main
import (
"fmt"
curl "github.com/andelf/go-curl"
)
func main() {
fooTest := func(buf []byte, userdata interface{}) bool {
//println("DEBUG: size=>", len(buf))
//println("DEBUG: content=>", string(buf))
return true
}
easy := curl.EasyInit()
defer easy.Cleanup()
for i := 0; i < 1000000; i++ {
easy.Setopt(curl.OPT_URL, "http://192.168.1.3/")
easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)
if err := easy.Perform(); err != nil {
fmt.Printf("ERROR: %v\n", err)
}
}
}
协程下同样如此:
package main
import (
"fmt"
curl "github.com/andelf/go-curl"
"sync"
)
func main() {
var wg sync.WaitGroup
var limit = make(chan struct{}, 200)
fooTest := func(buf []byte, userdata interface{}) bool {
//println("DEBUG: size=>", len(buf))
//println("DEBUG: content=>", string(buf))
return true
}
for i := 0; i < 1000000; i++ {
limit <- struct{}{}
wg.Add(1)
go func() {
easy := curl.EasyInit()
defer easy.Cleanup()
easy.Setopt(curl.OPT_URL, "http://192.168.1.3/")
easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)
}
The text was updated successfully, but these errors were encountered: