E
E
esc2015-03-20 13:57:07
go
esc, 2015-03-20 13:57:07

Leaks in the Go standard library?

The situation is almost identical to that described in this ticket: stackoverflow.com/questions/21080642/memory-leak-i...
I take the simplest code from the documentation:

package main

import (
    "net/http"
)

func main() {
    http.ListenAndServe(":8080", nil)
}

I run:
while [ true ]
do
    ab -n 1000 -c 100 http://127.0.0.1:8080/
    sleep 1
end

And I see how the program has more and more memory.
Damn, this is a standard example of the simplest library code call, how can this even be?
Who wrote web servers in Go, was it possible to do it without leaks using the standard library?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
esc, 2015-03-21
@esc

The first thing to check is the version of Go. early versions, even those that start with 1, are not particularly stable and suffer from leaks.
Secondly, you need to understand that keep-alive leaves connections open for some time and this affects the amount of memory consumed (however, when the activity becomes less, the memory will also be cleared over time). To make sure that it does not flow, it is worth disabling keep-alive for the test.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question