You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On line 1011 of request.js, he variable 'buffer' references an array which can become quite large depending on the size of the response body. Since the 'buffer' variable is referenced in a closure and never explicitly set to null, the buffer remains referenced for the life of the response object and can not be garbage collected. It would be much safer to prevent memory leaks, and minimally more efficient to set 'buffer = null' as soon as it is no longer required by this code so that it can be garbage collected.
The text was updated successfully, but these errors were encountered:
0x1mason
added a commit
to 0x1mason/request
that referenced
this issue
Apr 13, 2016
This fixes the issue mentioned in request#1723. The lifetime of the `buffer` variable defined in `readResponseBody` is linked to the `Request` object, rather than the enclosing function. This can lead to leaky behavior if references to the request persist in memory.
This PR simply destroys the buffer after it is no longer needed.
* Explicitly destroy response buffer
This fixes the issue mentioned in #1723. The lifetime of the `buffer` variable defined in `readResponseBody` is linked to the `Request` object, rather than the enclosing function. This can lead to leaky behavior if references to the request persist in memory.
On line 1011 of request.js, he variable 'buffer' references an array which can become quite large depending on the size of the response body. Since the 'buffer' variable is referenced in a closure and never explicitly set to null, the buffer remains referenced for the life of the response object and can not be garbage collected. It would be much safer to prevent memory leaks, and minimally more efficient to set 'buffer = null' as soon as it is no longer required by this code so that it can be garbage collected.
The text was updated successfully, but these errors were encountered: