How to destory the Admob adView completely and get the memory back? (If my app has a service)

1,233 views
Skip to first unread message

dong221

unread,
Mar 9, 2012, 4:22:59 AM3/9/12
to google-adm...@googlegroups.com
My app has an activity and a service. I recently introduce the Admob in my app.

However, I found it incredibly consuming the memory (5MB), and I can't get my memory back after destroy it.

I use this in my layout.xml

     <com.google.ads.AdView 
        android:id="@+id/adView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adUnitId="xxxxxx"
        ads:adSize="BANNER">

Enable the admob in my onCreate

AdView adView = (AdView)this.findViewById(R.id.adView);
adView.loadAd(new com.google.ads.AdRequest());

Destory it on my onPause or onDestory

AdView adView = (AdView)this.findViewById(R.id.adView);
adView.destroyDrawingCache();
adView.destroy();

After destroy it, I still can't get my 5mb memory back. Can somebody help pls?

1. My service is running on the background, and I could see a extra 5mb is add to my process.
2. Try to remove LoadAd and then 5mb is back.

Thanks.

Adam Zehavi

unread,
Mar 10, 2012, 9:46:30 AM3/10/12
to Google AdMob Ads Developers

William Ferguson

unread,
Mar 13, 2012, 12:33:30 AM3/13/12
to Google AdMob Ads Developers
This WAS a problem in SDKs circa 4.1.0
I have seen no evidence of this in 4.3.1

William


On Mar 11, 12:46 am, Adam Zehavi <Adam.Zeh...@nu-art-software.com>
wrote:
> This is a problem in the sdk...
>
> http://stackoverflow.com/questions/6148812/android-admob-causes-memor...
>
> http://stackoverflow.com/questions/9558708/admob-memory-leak-avoiding...

Adam Zehavi

unread,
Mar 14, 2012, 2:40:08 AM3/14/12
to Google AdMob Ads Developers
I'm Using 4.3.1, and it is still there...

The only way to avoid it is with the workaround...

Perhaps there is a scenario where it persists...

Good day.

On Mar 13, 6:33 am, William Ferguson <william.ferguson...@gmail.com>
wrote:

William Ferguson

unread,
Mar 14, 2012, 11:56:35 PM3/14/12
to Google AdMob Ads Developers
Well I haven't been able to replicate it on any emulator instance not
on the 5 test devices I have.
Is there a specific emulator instance on which you can replicate it?
And what steps do you take to replicate it?

William


On Mar 14, 4:40 pm, Adam Zehavi <Adam.Zeh...@nu-art-software.com>
wrote:

Leon Mendelson

unread,
Mar 14, 2012, 11:58:34 PM3/14/12
to google-adm...@googlegroups.com
are you from Admob ?

Helder Martins

unread,
Mar 15, 2012, 9:43:10 PM3/15/12
to google-adm...@googlegroups.com
That memory leak is happening to me also, with version 4.3.1 of the SDK at my Desire HD, Gingerbread. 

At my app, when I click a button it creates another instance of the same Activity. No internet call and anything, it jsut read from a parcel what the previous instance sent to it. This activity has also a AdMob banner.
The memory usage increases very fast, and never is collected. When I track it using the Allocation Tracker, the champion of memory usage is this getBuf() method from android.net.http.Connection class. I imagine that this is some connection that AdMob is failing to close. Call stack below:

Class                                         Method                    File                     Line Native
android.net.http.Connection           getBuf              Connection.java 716 false
android.net.http.Request       readResponse        Request.java 346 false
android.net.http.Connection        processRequests Connection.java 387 false
android.net.http.ConnectionThread  run              ConnectionThread.java 144 false

Does this rings a bell at someone? I'm seriously considering removing the Ads banner from my app.


On Thursday, March 15, 2012 12:58:34 AM UTC-3, Leon wrote:
are you from Admob ?


On Thu, Mar 15, 2012 at 10:56 AM, William Ferguson

William Ferguson

unread,
Mar 16, 2012, 2:10:50 AM3/16/12
to google-adm...@googlegroups.com
Me? no. Just someone who had to deal with the issue extensively in 4.1 of the SDK.

William


On Thursday, March 15, 2012 1:58:34 PM UTC+10, Leon wrote:
are you from Admob ?


On Thu, Mar 15, 2012 at 10:56 AM, William Ferguson

> Well I haven't been able to replicate it on any emulator instance not
> on the 5 test devices I have.
> Is there a specific emulator instance on which you can replicate it?
> And what steps do you take to replicate it?
>
> William
>
>
> On Mar 14, 4:40 pm, Adam Zehavi <Adam.Zeh...@nu-art-software.com>
> wrote:
>> I'm Using 4.3.1, and it is still there...
>>
>> The only way to avoid it is with the workaround...
>>
>> Perhaps there is a scenario where it persists...
>>
>> Good day.
>>

>> On Mar 13, 6:33 am, William Ferguson wrote:

Reply all
Reply to author
Forward
0 new messages