expressjs / expressjs/multer

Why does Multer does not release memory?

Open
#1,242 2 comments 0 reactions 0 assignees View on GitHub
discuss
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I am developing node application to upload files, I can see that when multer receives a request with file 200KB for example, it then holds 400KB in the memory and does not release it even after the request finishes until the app receives a new request and do the same with the next request.

`const multer = require("multer");
const storage = multer.memoryStorage();
const upload = multer({
storage: storage
});

const app = express();
const port = process.env.PORT || 3002;

app.use(express.json());

app.post("/submitRequest", upload.single("file"), async (req, res) => {
return res.send('ok')
});

const server = app.listen(port, () => {
console.log(`Server is running on https://localhost:${port}`);
});

console.log('Server started at:', new Date().toLocaleString());
Screenshot 2024-02-09 213757
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.