{"action":"opened","issue":{"url":"https://api.github.com/repos/OpenUnirest/unirest-java/issues/48","repository_url":"https://api.github.com/repos/OpenUnirest/unirest-java","labels_url":"https://api.github.com/repos/OpenUnirest/unirest-java/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/OpenUnirest/unirest-java/issues/48/comments","events_url":"https://api.github.com/repos/OpenUnirest/unirest-java/issues/48/events","html_url":"https://github.com/OpenUnirest/unirest-java/issues/48","id":389652662,"node_id":"MDU6SXNzdWUzODk2NTI2NjI=","number":48,"title":"OutOfMemoryError on large file download on asBinary","user":{"login":"Catscratch","id":1955624,"node_id":"MDQ6VXNlcjE5NTU2MjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1955624?v=4","gravatar_id":"","url":"https://api.github.com/users/Catscratch","html_url":"https://github.com/Catscratch","followers_url":"https://api.github.com/users/Catscratch/followers","following_url":"https://api.github.com/users/Catscratch/following{/other_user}","gists_url":"https://api.github.com/users/Catscratch/gists{/gist_id}","starred_url":"https://api.github.com/users/Catscratch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catscratch/subscriptions","organizations_url":"https://api.github.com/users/Catscratch/orgs","repos_url":"https://api.github.com/users/Catscratch/repos","events_url":"https://api.github.com/users/Catscratch/events{/privacy}","received_events_url":"https://api.github.com/users/Catscratch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-11T08:47:35Z","updated_at":"2018-12-11T08:47:35Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI got a java.lang.OutOfMemoryError when downloading a 2GB zip file with `io.github.openunirest.request.BaseRequest.asBinary`.\r\n\r\nHere is the StackTrace:\r\n`\r\njava.lang.OutOfMemoryError: null\r\n    at java.io.ByteArrayOutputStream.hugeCapacity(ByteArrayOutputStream.java:123)\r\n    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:117)\r\n    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)\r\n    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)\r\n    at io.github.openunirest.http.utils.ResponseUtils.getBytes(ResponseUtils.java:51)\r\n    at io.github.openunirest.http.utils.ResponseUtils.getRawBody(ResponseUtils.java:85)\r\n    at io.github.openunirest.http.BodyData.<init>(BodyData.java:38)\r\n    at io.github.openunirest.http.BodyData.from(BodyData.java:21)\r\n    at io.github.openunirest.request.ResponseBuilder.asBinary(ResponseBuilder.java:25)\r\n    at io.github.openunirest.request.HttpClientHelper.request(HttpClientHelper.java:34)\r\n    at io.github.openunirest.request.BaseRequest.asBinary(BaseRequest.java:95)\r\n`\r\n\r\nProblem is the ByteArrayOutputStream which holds the whole file in memory.\r\n\r\nE.g. with Jersey its working. Jersey uses mimepull library.\r\norg.jvnet.mimepull.DataHead$ReadMultiStream\r\n\r\nMaybe it would be a nice improvement to use the same? Or any other equivalent?"}}
{"actor":{"display_login":"Catscratch"}}