Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: Copy makes garbage #5509

Closed
bradfitz opened this issue May 17, 2013 · 9 comments
Closed

io: Copy makes garbage #5509

bradfitz opened this issue May 17, 2013 · 9 comments

Comments

@bradfitz
Copy link
Contributor

io.Copy generates unnecessary garbage.

Possible fix: https://golang.org/cl/7206048/
@bradfitz
Copy link
Contributor Author

Comment 1:

Labels changed: added garbage, pero, removed gara.

@bradfitz
Copy link
Contributor Author

Comment 2:

Labels changed: added performance, removed pero.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 4:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added repo-main.

@dvyukov
Copy link
Member

dvyukov commented Jan 27, 2015

Looks like a good fit for sync.Pool. But do we want io to depend on sync (the only other package that sync depends on is sync/atomic)?

@crawshaw
Copy link
Member

The io package already depends on sync. http://golang.org/src/io/pipe.go#L10 (This dependency is listed in src/go/build/deps_test.go.)

@dvyukov
Copy link
Member

dvyukov commented Jan 28, 2015

aha!

@dvyukov
Copy link
Member

dvyukov commented Jan 28, 2015

On Wed, Jan 28, 2015 at 5:58 PM, 'Russ Cox (Gerrit)' wrote:

There's no guarantee that old data isn't leaking, that a bad Reader or
Writer isn't holding onto the buffer, and so on. I don't believe this is an
appropriate use of a Pool.

See the following changes for discussion:
https://codereview.appspot.com/7206048/
https://go-review.googlesource.com/#/c/3413/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants