Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(82)

Issue 4273072: code review 4273072: go/parser: fix memory leak by making a copy of token li... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years ago by gri
Modified:
15 years ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

go/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/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -14 lines) Patch
M src/pkg/go/parser/parser.go View 1 10 chunks +23 lines, -14 lines 0 comments Download

Messages

Total messages: 3
gri
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
15 years ago (2011-03-17 22:28:26 UTC) #1
rsc
LGTM
15 years ago (2011-03-17 22:29:54 UTC) #2
gri
15 years ago (2011-03-17 22:32:31 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=be3f3287a5b0 ***

go/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%).

R=rsc
CC=golang-dev
http://codereview.appspot.com/4273072
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b