Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Out of memory on file upload. #127

Open
@mfahy

Description

@mfahy

Without fail, any file larger than a couple megs immediately returns an Out-of-Memory error when I attempt to post it using AsyncHTTPRequest. It appears the SimpleMultipartEntity file included builds the file in memory befre sending? Is there a way to get this to chunk & send the file in smaller bites?

 FATAL EXCEPTION: main
 java.lang.OutOfMemoryError
 at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
 at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:216)
 at com.loopj.android.http.SimpleMultipartEntity.addPart(SimpleMultipartEntity.java:114)
 at com.loopj.android.http.SimpleMultipartEntity.addPart(SimpleMultipartEntity.java:100)
 at com.loopj.android.http.RequestParams.getEntity(RequestParams.java:234)
 at com.loopj.android.http.AsyncHttpClient.paramsToEntity(AsyncHttpClient.java:584)
 at com.loopj.android.http.AsyncHttpClient.post(AsyncHttpClient.java:389)
 at com.loopj.android.http.AsyncHttpClient.post(AsyncHttpClient.java:378)
 at XXX.XXXXXX.XXX.doNet(ZZxxxxClient.java:143)
 at XXX.XXXXXX.XXX.postThread(ZZxxxxClient.java:175)
 at XXX.XXXXXX.X.DelegatedActivity$1.onClick(DelegatedActivity.java:114)
 at android.view.View.performClick(View.java:2537)
 at android.view.View$PerformClick.run(View.java:9157)
 at android.os.Handler.handleCallback(Handler.java:587)
 at android.os.Handler.dispatchMessage(Handler.java:92)
 at android.os.Looper.loop(Looper.java:130)
 at android.app.ActivityThread.main(ActivityThread.java:3687)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:507)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
 at dalvik.system.NativeStart.main(Native Method)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions