Descriptiongo/parser: fix memory leak by making a copy of token literals
The scanner returns slices into the original source
for token values. If those slices are making it into
the AST and from there into other long-living data
structures (e.g. godoc search), references to the
original source are kept around involuntarily.
For the current godoc and source tree, this change reduces
memory consumption after indexing and before GC by ~92MB
or almost 30%, and by ~10MB after GC (or about 6%).
Patch Set 1 #Patch Set 2 : diff -r af282843c33a https://go.googlecode.com/hg/ #Patch Set 3 : diff -r af282843c33a https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 490ea9334d13 https://go.googlecode.com/hg/ #MessagesTotal messages: 3
|