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.

Screen Shot 2020-12-05 at 3 38 31 PM

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Reproduced on v1.4.0 A new related issue opened - see https://github.com/axios/axios/issues/5641

I test all versions following image.

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. image

@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.