Android jpush 出现几千条OutOfMemoryError

android
jpush
崩溃
标签: #<Tag:0x00007fb83ce9dbc0> #<Tag:0x00007fb83ce9da80> #<Tag:0x00007fb83ce9d940>

(elaine) #1

jpush-android_v3.0.6
jcore-android_v1.1.3

友盟后台出现几千条OutOfMemoryError错误

java.lang.OutOfMemoryError
	at java.lang.String.<init>(String.java:422)
	at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:642)
	at java.lang.StringBuilder.toString(StringBuilder.java:663)
	at org.json.JSONStringer.toString(JSONStringer.java:430)
	at org.json.JSONObject.toString(JSONObject.java:642)
	at cn.jiguang.b.d.o.a(Unknown Source)
	at cn.jiguang.a.a.d.b.b(Unknown Source)
	at cn.jiguang.a.a.d.f.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)

还有

java.lang.OutOfMemoryError
	at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
	at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:132)
	at java.lang.StringBuilder.append(StringBuilder.java:124)
	at org.json.JSONStringer.string(JSONStringer.java:344)
	at org.json.JSONStringer.key(JSONStringer.java:375)
	at org.json.JSONObject.writeTo(JSONObject.java:672)
	at org.json.JSONStringer.value(JSONStringer.java:237)
	at org.json.JSONArray.writeTo(JSONArray.java:602)
	at org.json.JSONStringer.value(JSONStringer.java:233)
	at org.json.JSONObject.writeTo(JSONObject.java:672)
	at org.json.JSONObject.toString(JSONObject.java:641)
	at cn.jiguang.b.d.o.a(Unknown Source)
	at cn.jiguang.a.a.d.b.b(Unknown Source)
	at cn.jiguang.a.a.d.f.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)

#2

这个问题我们确认下原因


(哈哈哈哈) #3

这个问题我在小米红米手机2(4.4.4),Jpush版本3.1.1,jcore:1.1.9上重复出现几百次,请问你们这边更新sdk后是否能解决这个问题?


#4

给出你的错误信息。


(哈哈哈哈) #5
java.lang.OutOfMemoryError
	at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
	at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:145)
	at java.lang.StringBuilder.append(StringBuilder.java:216)
	at cn.jiguang.d.d.o.a(Unknown Source)
	at cn.jiguang.d.d.o.b(Unknown Source)
	at cn.jiguang.d.d.r.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)
Back traces end.

#6

该问题我们在最新版本有进行优化。
线程创建过多导致的OutOfMemoryError。不能完全避免,因为App开发者可能创建太多线程,而到我们SDK再创建的时候就报错了,我们只能尽力优化。
https://docs.jiguang.cn/jpush/updates/#jpush-android-sdk-v317