You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/10/20 18:56:20 UTC

[GitHub] [beam] jrmccluskey commented on a change in pull request #15762: [BEAM-13082] Re-use dataWriter buffer.

jrmccluskey commented on a change in pull request #15762:
URL: https://github.com/apache/beam/pull/15762#discussion_r733059677



##########
File path: sdks/go/pkg/beam/core/runtime/harness/datamgr.go
##########
@@ -529,7 +531,6 @@ func (w *dataWriter) Flush() error {
 	if w.buf == nil {

Review comment:
       Why not delay getting the lock for the channel until after the check that the buffer is non-nil? 

##########
File path: sdks/go/pkg/beam/core/runtime/harness/datamgr.go
##########
@@ -502,6 +502,8 @@ func (w *dataWriter) Close() error {
 	if err != nil {
 		return errors.Wrapf(err, "dataWriter[%v;%v].Close: error flushing buffer of length %d", w.id, w.ch.id, l)
 	}
+	// TODO(BEAM-13082): Consider a sync.Pool to reuse < 64MB buffers.
+	w.buf = nil

Review comment:
       You're free to release the buffer to garbage collection here because the specific dataWriter won't be re-used, right? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org