Lower memory consumption: SpringSingleMultipartFileWriter
See original GitHub issueThe write method of SpringSingleMultipartFileWriter.java uses a lot of memory:
@Override
protected void write (Output output, String key, Object value) throws EncodeException {
val file = (MultipartFile) value;
writeFileMetadata(output, key, file.getOriginalFilename(), file.getContentType());
byte[] bytes;
try {
bytes = file.getBytes();
} catch (IOException ex) {
throw new EncodeException("Getting multipart file's content bytes error", ex);
}
output.write(bytes);
}
Is it possible to use file.getInputStream() in some kind of way? It will require a lot of refactoring… now large files are loaded inside the memory twice.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:5
Top Results From Across the Web
How to reduce memory usage on your Mac - Setapp
Fix "kernel_task", a high CPU usage bug · Reduce memory usage in Finder · Improve Chrome's Task Manager · Clean up browsers ·...
Read more >how to reduce spring boot memory usage? - Stack Overflow
My JVM options are (-Xmx64M -Xms64M -XX:MaxPermSize=64M -server), why is it that in the x64 server, memory usage is so big? how to...
Read more >How to clear RAM on Mac and reduce memory usage - MacPaw
Tip # 1. Remove Login Items to lower Mac memory usage. Login Items are programs that load automatically upon Mac startup. Some of...
Read more >Optimizing Memory Usage in Python Applications
Find the reasons why your Python applications are using too much memory, analyze them and reduce their memory consumption and footprint using simple...
Read more >How to Lower Memory (RAM) Usage on Mac - BuhoCleaner
This blog post will tell you how to free up RAM and reduce memory usage in eight easy ways.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Facing the same issue with transferring uploaded files through Feign-equipped applications. It would be much more efficient for memory consumption if Feign could treat uploaded files as byte streams rather than byte arrays.
Thanks @koziolk for the fast response. I was thinking to do the same approach and have two clients for the short term.