Reputation: 803
Let's think over this situation. You have a small heap, about 15-16MB and you want to send a huge file, but not as big as heap size via REST post. In Android there's a whole API to do it but it requires you to enclose data in StringEntity where there are only up to two params. String which is body and Charset. Let's say you have a file which is about 10MB. Everything is going well until you are putting data into StringEntity where an Exception occurs: OutOfMemory with description about full stack.
How do I solve this problem without chunking data?
Upvotes: 0
Views: 544
Reputation: 569
Use a FileEntity
instead. That will stream the data into the request instead of loading it into memory.
Upvotes: 1