axios: Axios response memory leak
Describe the bug
I think that Axios has a serious memory leak. The Axios responses are never removed from memory.
To Reproduce
Create a new node project.
npm i axios && touch index.js
const axios = require('axios');
// Perform 1 request per second.
setInterval(async () => {
const response = await axios.get("https://wikipedia.com");
console.log("Done getting response!");
}, 1000)
Expected behavior
I would expect this program to not keep a reference to every response. But unfortunately, it does.
Environment
- Axios Version 0.21.0
- Node.js Version 14.12.0
- OSX 10.15.6
Additional context/Screenshots
The Chrome memory profiler shows that the Wikipedia responses are stored in memory.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Remove listeners on abort. Fixes https://github.com/axios/axios/issues/3457 — committed to follow-redirects/follow-redirects by splitice 6 years ago
- hotfix(axios): fix memory leak https://github.com/axios/axios/issues/3457 https://github.com/axios/axios/pull/3694 — committed to JellyBrick/KRList-Stats by JellyBrick 5 years ago
Reproduced on v1.4.0 A new related issue opened - see https://github.com/axios/axios/issues/5641
I test all versions following
.
the results show that memory usage will always increase, so there seems still memory leakage. can someone reopen this issue? do we have any quick workaround?
and I used the chrome inspect to investigate the reason. and find the main leakage resource is a string referenced by root.
@yuvalbl - It still exists in Cancel.js as of 1.6.2 from the look of things. crypto, dns-text that I can ascertain thus far.