OutputStream OutOfMemoryError when sending HTTP
The HttpUrlConnection is buffering the data so that it can set the Content-Length header (per HTTP spec). One alternative, if your destination server supports it, is to use “chunked” transfers. This will buffer only a small portion of data at a time. However, not all services support it (Amazon S3, for example, doesn’t). Another alternative … Read more