Discourage using ReleaseBody, since now bytebufferpool should properly handle the case mentioned in #102

This commit is contained in:
Aliaksandr Valialkin
2016-06-27 18:26:56 +03:00
parent 15c8282c3f
commit 778f83ed89
+6
View File
@@ -447,6 +447,9 @@ func (resp *Response) ResetBody() {
//
// This permits GC to reclaim the large buffer. If used, must be before
// ReleaseResponse.
//
// Use this method only if you really understand how it works.
// The majority of workloads don't need this method.
func (resp *Response) ReleaseBody(size int) {
if cap(resp.body.B) > size {
resp.closeBodyStream()
@@ -458,6 +461,9 @@ func (resp *Response) ReleaseBody(size int) {
//
// This permits GC to reclaim the large buffer. If used, must be before
// ReleaseRequest.
//
// Use this method only if you really understand how it works.
// The majority of workloads don't need this method.
func (req *Request) ReleaseBody(size int) {
if cap(req.body.B) > size {
req.closeBodyStream()