Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

out of memory error , my app's fault?

i have a aplication on the android market , in wich exceptions and errors are catched and sent to me by acra.

But i receive quite a lot out of memory errors.. In different kind of classes...some my app, some general java..

Does this always mean there is a problem in my app, or can it also be the phone ran out of memory due to a other process?

Will users also get a fc dialog ?

Additional Information

There is nothing memory intensite in my app..

no images...no big chunks of data.. only a simple view..and most intensive a mobclix ad..

i'm new to java...so i may have a leak somewhere..but i do find it hard to debug that. But at this point i'm not even sure there is someting wrong...

i get about 25 -50 OOM error's daily..but compared to 60.000 ads it shows a day. (i show only 1 or 2 ads for each time it's started) that is not too much.

1 receive errors like :

"java.lang.OutOfMemoryError
at org.apache.http.impl.io.AbstractSessionInputBuffer.init(AbstractSessionInputBuffer.java:79)
at org.apache.http.impl.io.SocketInputBuffer.<init>(SocketInputBuffer.java:93)
at android.net.http.AndroidHttpClientConnection.bind(AndroidHttpClientConnection.java:114)
at android.net.http.HttpConnection.openConnection(HttpConnection.java:61)
at android.net.http.Connection.openHttpConnection(Connection.java:378)
at android.net.http.Connection.processRequests(Connection.java:237)
at android.net.http.ConnectionThread.run(ConnectionThread.java:125)

"

"java.lang.OutOfMemoryError
at java.io.BufferedReader.<init>(BufferedReader.java:102)
at com.mobclix.android.sdk.Mobclix$FetchResponseThread.run(Mobclix.java:1422)
at com.mobclix.android.sdk.MobclixAdView$FetchAdResponseThread.run(MobclixAdView.java:390)
at java.util.Timer$TimerImpl.run(Timer.java:290)

"

"java.lang.OutOfMemoryError
at org.apache.http.util.ByteArrayBuffer.<init>(ByteArrayBuffer.java:53)
at org.apache.http.impl.io.AbstractSessionOutputBuffer.init(AbstractSessionOutputBuffer.java:77)
at org.apache.http.impl.io.SocketOutputBuffer.<init>(SocketOutputBuffer.java:76)
at android.net.http.AndroidHttpClientConnection.bind(AndroidHttpClientConnection.java:115)
at android.net.http.HttpConnection.openConnection(HttpConnection.java:61)
at android.net.http.Connection.openHttpConnection(Connection.java:378)
at android.net.http.Connection.processRequests(Connection.java:237)
at android.net.http.ConnectionThread.run(ConnectionThread.java:125)

"

So the main question is..am i leaking somewhere.. or can this be considered normal because in a small % of cases the phone may be out of memory due to other aplications running on it.

like image 637
arnold Avatar asked Jun 16 '10 17:06

arnold


People also ask

Why does my Mac keep running out of application memory?

Running several apps simultaneously can lead to “your system has run out of application memory” notification along with a suggestion to close several apps. Browser lagging. Having lots of tabs open or installing numerous extensions may lead to issues in application memory Mac.

How do I fix Android out of memory error?

If you haven't seen any OOM in your Android application, then you are going to have one in future. The OutOfMemoryError comes in Android due to memory leaks. So, in order to remove the OutOfMemoryError, you need to remove memory leaks from your Android application.

What causes out of memory error?

An out of memory error causes programs — or even the entire computer — to power down. This problem is typically caused either by low random access memory (RAM), too many programs or hardware pieces running at once, or a large cache size that absorbs a large amount of memory.


1 Answers

A common JVM problem is that only unreferenced objects can be removed by the Garbage Collector. If you have large persistent objects then it's important to set unused variables in those objects to null so that they are dereferenced. A classic problem is keeping something like a HashMap object around with a lot of values in it when you don't need it since every entry in the HashMap is chewing up memory.

like image 60
Michael Shopsin Avatar answered Sep 25 '22 01:09

Michael Shopsin