Help! Memory not freeing when receiving multipart files when ERR_STREAM_PREMATURE_CLOSE
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
## 💬 Memory not freeing when receiving multipart files when ERR_STREAM_PREMATURE_CLOSE
How can I make Fastify clear up memory when an error occurs during request.saveRequestFiles() specifically ERR_STREAM_PREMATURE_CLOSE?
I have tried below code but it still doesn't free up memory
```js
let files;
try {
files = await request.saveRequestFiles();
} catch (e) {
console.log("Error saving files", e);
await request.cleanRequestFiles();
reply.code(500).send("Internal Server Error");
return;
}
```
[GitHub](https://github.com/Kuyumee/kuyumee-api/blob/main/api/upload.js#L2-L12)
The graph shows that it takes half a day for the uploaded data to be released from memory

## Your Environment
- *node version*: v16.17.0
- *fastify version*: ^4.17.0
- *os*: Windows
Contributor guide
Assessment
This issue has not been assessed yet.