Skip to content

bufio + net: memory leak #5318

@gpaul

Description

@gpaul
This follows from issue #5314

go version:
go version devel +58f8a30f5b78 Tue Apr 16 14:20:06 2013 -0700 linux/amd64

uname -a:
Linux me 3.3.8-1.fc16.x86_64 #1 SMP Mon Jun 4 20:49:02 UTC 2012 x86_64 x86_64 x86_64
GNU/Linux

Code to reproduce is here:
http://play.golang.org/p/7tTgtZHa-F

It creates a bunch of goroutines that block in (*bufio.Reader).Read from a blocking
net.Conn. These never die. They call Handle() which allocates and cuts apart a 64MB byte
slice, then returns. It takes no input parameters and returns nothing, so all garbage in
it should be collected.

This does not happen though, the heap profile grows and says nearly everything was
allocated in the Handle() and never freed.

Running with GOGCTRACE=1 shows the heap grow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions