Memory leaks issues
- Dominant language
- JavaScript
- Stars
- 7.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
I'm having some memory leaks problems.
This is my code:
```
const AnyProxy = require('anyproxy');
const options = {
port: 8001,
rule: {
* beforeDealHttpsRequest(requestDetail) { /* ... */
return true;
},
},
webInterface: {
enable: false,
webPort: 8002
},
throttle: 10000,
forceProxyHttps: true,
wsIntercept: false,
silent: false
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.on('ready', () => {
console.log('ready');
});
proxyServer.on('error', (e) => {
console.log('error ocurred', e);
});
proxyServer.start();
proxyServer.close();
```
When i start the server, my memory consumption is about 30MB.
When i make a request behind the proxy like this:
curl -i -X POST -H "Content-Type: multipart/form-data" -F "file=@/file" -k -v --insecure --proxy-insecure --proxy http://localhost:8001 "https://website.com"
After request finishes, my memory increases in the same size of the file that i've sent in the request. After tests, the problem seems to happen only in POST requests. GET is fine.
Inspecting the memory dump difference on Chrome's inspection, i see an variable (string) called reqBody[0] with all body request stored on memory.

Anyone can help how to fix this, please? Facing this issue on production server :/
Thanks for looking!
#### Which platform are you running AnyProxy
Tested on MacOS High Sierra and CentOS 7
#### The version of the AnyProxy
4.1.2
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue through AnyProxy.ProxyServer with the supplied multipart POST command, then inspect the request handling around reqBody[0] and beforeDealHttpsRequest. Compare memory after POST and GET requests; done means the uploaded request body is no longer retained after the POST completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100