2 llx2015 llx2015 于 2016.01.13 15:59 提问

android :Throwing OutOfMemoryError.

最近发现APP在部分三星类型手机上面出现了内存溢出的问题,时有时无,不知道哪里出了问题,哪位大神指点下。

 01-13 15:50:26.874: E/ViewRootImpl(3441): sendUserActionEvent() mView == null

01-13 15:50:27.064: E/art(3441): Throwing OutOfMemoryError "Failed to allocate a 6144012 byte allocation with 5750804 free bytes and 5MB until OOM"

01-13 15:50:27.064: E/Resources(3441): ExecutionException

01-13 15:50:27.064: E/Resources(3441): java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Failed to allocate a 6144012 byte allocation with 5750804 free bytes and 5MB until OOM

01-13 15:50:27.064: E/Resources(3441):  at java.util.concurrent.FutureTask.report(FutureTask.java:93)

01-13 15:50:27.064: E/Resources(3441):  at java.util.concurrent.FutureTask.get(FutureTask.java:163)

01-13 15:50:27.064: E/Resources(3441):  at android.content.res.Resources.getRCCachedDrawable(Resources.java:3625)

01-13 15:50:27.064: E/Resources(3441):  at android.content.res.Resources.loadDrawable(Resources.java:3532)

01-13 15:50:27.064: E/Resources(3441):  at android.content.res.TypedArray.getDrawable(TypedArray.java:762)

01-13 15:50:27.064: E/Resources(3441):  at android.view.View.<init>(View.java:3957)

01-13 15:50:27.064: E/Resources(3441):  at android.view.ViewGroup.<init>(ViewGroup.java:507)

01-13 15:50:27.064: E/Resources(3441):  at android.widget.LinearLayout.<init>(LinearLayout.java:199)

01-13 15:50:27.064: E/Resources(3441):  at android.widget.LinearLayout.<init>(LinearLayout.java:195)

01-13 15:50:27.064: E/Resources(3441):  at android.widget.LinearLayout.<init>(LinearLayout.java:191)

01-13 15:50:27.064: E/Resources(3441):  at java.lang.reflect.Constructor.newInstance(Native Method)

01-13 15:50:27.064: E/Resources(3441):  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.createView(LayoutInflater.java:614)

01-13 15:50:27.064: E/Resources(3441):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.inflate(LayoutInflater.java:511)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.inflate(LayoutInflater.java:415)

01-13 15:50:27.064: E/Resources(3441):  at android.view.LayoutInflater.inflate(LayoutInflater.java:366)

01-13 15:50:27.064: E/Resources(3441):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:428)

01-13 15:50:27.064: E/Resources(3441):  at android.app.Activity.setContentView(Activity.java:2267)

01-13 15:50:27.064: E/Resources(3441):  at ixz.fish_help_app.DevListActivity.onCreate(DevListActivity.java:188)

01-13 15:50:27.064: E/Resources(3441):  at android.app.Activity.performCreate(Activity.java:6288)

01-13 15:50:27.064: E/Resources(3441):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)

01-13 15:50:27.064: E/Resources(3441):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)

01-13 15:50:27.064: E/Resources(3441):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)

01-13 15:50:27.064: E/Resources(3441):  at android.app.ActivityThread.access$900(ActivityThread.java:177)

01-13 15:50:27.064: E/Resources(3441):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)

01-13 15:50:27.064: E/Resources(3441):  at android.os.Handler.dispatchMessage(Handler.java:102)

01-13 15:50:27.064: E/Resources(3441):  at android.os.Looper.loop(Looper.java:145)

01-13 15:50:27.064: E/Resources(3441):  at android.app.ActivityThread.main(ActivityThread.java:5942)

01-13 15:50:27.064: E/Resources(3441):  at java.lang.reflect.Method.invoke(Native Method)

01-13 15:50:27.064: E/Resources(3441):  at java.lang.reflect.Method.invoke(Method.java:372)

01-13 15:50:27.064: E/Resources(3441):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)

01-13 15:50:27.064: E/Resources(3441):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

01-13 15:50:27.064: E/Resources(3441): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 6144012 byte allocation with 5750804 free bytes and 5MB until OOM

01-13 15:50:27.064: E/Resources(3441):  at dalvik.system.VMRuntime.newNonMovableArray(Native Method)

01-13 15:50:27.064: E/Resources(3441):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)

01-13 15:50:27.064: E/Resources(3441):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:747)

01-13 15:50:27.064: E/Resources(3441):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:568)

01-13 15:50:27.064: E/Resources(3441):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1014)

01-13 15:50:27.064: E/Resources(3441):  at android.content.res.Resources$RCCallable.call(Resources.java:1168)

01-13 15:50:27.064: E/Resources(3441):  at android.content.res.Resources$RCCallable.call(Resources.java:1147)

01-13 15:50:27.064: E/Resources(3441):  at java.util.concurrent.FutureTask.run(FutureTask.java:237)

01-13 15:50:27.064: E/Resources(3441):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

01-13 15:50:27.064: E/Resources(3441):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

01-13 15:50:27.064: E/Resources(3441):  at java.lang.Thread.run(Thread.java:818)

报错位置

 super.onCreate(savedInstanceState);

        context = this;
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.activity_dev_list);   //在这行
        Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtHandler());
        tmp_view = getWindow().getDecorView();


        dev_info = new dev_info(this);

3个回答

llx2015
llx2015   2016.01.14 10:51
已采纳

问题解决了。在开机动画中使用AnimationDrawable,在动画结束后忘记使用AnimationDrawable.stop();了导致内存溢出

CSDNXIAON
CSDNXIAON   2016.01.13 16:01

Android_OutOfMemoryError
android OutOfMemoryError
Android关于OutOfMemoryError的一些思考
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

rui888
rui888   Ds   Rxr 2016.01.13 16:17
llx2015
llx2015 我没有使用bitmap,并且我代码出错的地方是登陆按钮按下去的时候,在给主界面分配view内存的时候报的溢出。
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Retrofit2.0 和Instant Run 冲突导致 java.lang.ArrayIndexOutOfBoundsException
项目改造,使用Retrofit作为网络请求,使用AS居然报下面的错:A/art: art/runtime/thread.cc:1344] Throwing new exception 'length=191; index=1434' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=
Android中的OutOfMemoryError
OOM 的产生 在使用C或C++语言时,我们可操作的内存空间就是整个设备的物理内存,程序员需要自己声明内存空间,也需要自己在恰当的时机释放掉内存,一旦出错就会造成内存泄漏。而Java语言为了解决这个问题,在操作系统之上创造了一个Java虚拟机(JVM),让Java语言编译后的字节码运行在此虚拟机之上。启动一个Java应用,会首先启动JVM,JVM 会向操作系统申请所需内存,然后把内存分成为栈
Terminate called after throwing an instance of 'ros::serialization::StreamOverrunException'
今天在用分布式跑在线导航程序时跳出这个error,查询到一下网址http://answers.ros.org/question/229478/terminate-called-after-throwing-an-instance-of-rosserializationstreamoverrunexception/ 原因为,订阅激光话题(scan)给的缓冲字节不够多,我只给了 50;另外就是激
数组越界造成的std::bad_alloc中断
<br />std::bad_alloc异常一般是在new的时候因为内存不足而引起的<br /> <br />但是数组的越界也会导致在越界代码后进行new,ifstream,ofstream等操作抛出异常<br /> <br />比如如下代码<br /> <br /> <br />int *p = new int[0]; for(int i = 0; i < 10; ++i) p[i] = 0; ofstream ofile("test.txt", ios::out); ofile
LeetCode terminate called after throwing an instance of 'std::logic_error' what(): basic_string::
错误提示: LeetCode进行案例测试运行时提示如下错误: terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid 原因解析: 输入测试案例时格式不符合要求,比如有多余的空格等
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct NULL not valid   主要原因:string对一个空指针进行操作。   例如:char* p = NULL: string str(p);         
今天遇到的bug
今天在调试代码c++的时候,遇到了两个bug。顺利的解决。 1.运行时,中断。错误提示:terminate called after throwing an instance of 'std::logic_error'  what():  basic_string::_S_construct NULL not valid google了一下,发现问题是,将NULL赋值给std::st
运行时错误:terminate called after throwing an instance of 'std::logic_error'
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct NULL not valid   主要原因:对一个空指针进行操作。   例如:char* p = NULL: string str(p);              //运行时报错
terminate called after throwing an instance of 'std::regex_error'(C++11)
#PS:要转载请注明出处,本人版权所有#PS:这个只是 《 我自己 》理解,如果和你的 #原则相冲突,请谅解,勿喷最近修改一个程序,增加了一些功能,为了方便移植,要用到C++11的正则表达式。这里我就想说明的是:TMD,GCC 语法实现了,库没有写完。。。QAQ,WC。什么不说了。目标:得到url(类似http://1.1.1.1:9001/group1/M00/00/37/wKgf
运行时错误: terminate called after throwing an instance of 'std::out_of_range'
<br />主要原因:读取内存越界!