Skip to content

html: html.Parse() leaks memory #5938

@gopherbot

Description

@gopherbot

by jake.austwick:

What steps will reproduce the problem?

Running the following gist produces the problem. I tried to make a smaller test case,
but it doesn't seem to leak when just parsing local files. It seems that html.Parse() is
not getting all the memory used garbage collected.

Memory will only leak using live URL's like the file below.

Sample Program:
https://gist.github.com/JakeAustwick/1cbdb5e9e3e778b4ff42

urls.txt (needed to run):
https://gist.github.com/JakeAustwick/82c9d4ce300639a4d275/raw/368c41ce6ba95f03cbc25a188dd3c07646a068b0/gistfile1.txt

What is the expected output?

Memory not to increase until system memory is exhausted.

What do you see instead?

Memory slowly increases until it is all gone. Increase WORKER_COUNT to increase leakage
speed.

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Ubuntu 12.10

Which version are you using?  (run 'go version'):

go version go1.1 linux/amd64

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