android-developers
[Arriba] [Todas las Listas]

[android-developers] Re: Tracking Abajo casos de Actividad múltiple en

To: android-developers@xxxxxxxxxxxxxxxx
Subject: [android-developers] Re: Tracking Abajo casos de Actividad múltiple en memoria
From: Nathan <nathan.d.mellor@xxxxxxxxx>
Date: Wed, 17 Sep 2014 14:35:29 -0700 (PDT)
Delivery-date: Thu, 18 Sep 2014 00:19:51 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=/MV7qR9S8/CKfupJt7EdB2VUpkzlnvgUtSDr+G+QgOQ=; b=Yqum5QWBr2IT26CLuV1TOHjxWaTjHFvQZwjT/wf38pugNNqLX1WMHs3uS5y+Zh75MN jkqXDXPY3d9Et8xUz4Zo3p8D8jBbGmwRWs1aTR1XjEw41R/9hkSe8Q3HLow8mqC5Onyo OI+r5ViG0oZWDWNrCilDaQ91XmknECQemriOJmGhhaOwBiI7B9jjXD7LLPCZv7Blqk4u VXZaUkzRIhE05gMXBKWi9qo8XT+XxffvdIofSkmOcvJJ9bokW7qJgEXNv5GmjcmMEpJm TUVZv3Bvrl7PGTF8BFb4ahyNBHtH06mjYzkqMepNWaqfPKK07uLwbLfFDv9/Nqa4wBDN S3KQ==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=/MV7qR9S8/CKfupJt7EdB2VUpkzlnvgUtSDr+G+QgOQ=; b=YfhqgxU2VUTm0A1U1WPo4+qZbvSG9VdGXAkl2KGJrBoR94osa3MG4h+7QWDwbEIPVG MU6esCkX5ELC5sHotsKBI+NaxfidPKXpGV1c4GdGBPvQgbEF4ZjPD9Zn+llreSv6jNJt t6CrLx90EC0ox8WaAySxe1tqCHa8HwrbYagynsQfMdK5yXlQp78XaRQ4dQ/5mASwB+7B JjTFchly42xFAM4cH5IS8CvfsNCsChIWRkjK4c2E+jiQXYHL9NQcC2C0eIFIxAsJzPjs jq+ZwoM/DnVWBHwtyB6QXSx53PJu4pG8ypLfzh31d+lR2GNT2hAxGi++b9gV6ap+SfbI AQxA==
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <43640fe8-9cba-4173-9bc1-871e1b918562@googlegroups.com>
List-archive: <http://groups.google.com/group/android-developer>
List-help: <http://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>, <http://groups.google.com/group/android-developers/subscribe>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <75fe8bab-ade3-4f65-b2f7-cc2bc18cb1a1@googlegroups.com> <43640fe8-9cba-4173-9bc1-871e1b918562@googlegroups.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
Tener que *WeakReferences impedir colección de basura? Pensé que eran débil 
porque no impidieron colección de basura. 

Estoy viendo que algunos del *Android las clases están aguantando *static colecciones 
de material. No puedo ver donde estoy causando que *behavior, pero mantengo probar. 

De hecho, algunos de los artículos en este tema sugieren reemplazar vuestras 
clases interiores anónimas con nombrado, *static clases interiores que haber 
*WeakReferences a la actividad exterior. hay cuarenta de aquellas clases 
interiores, con todo el *clicklisteners y *whatnot. Es bastante un poco de *turmoil 
para cambiarles todo, pero puedo hacer aquello. 

Todo en todo, cuando mostrado aquí, estas cosas son a menudo oscuro.  
Me tomó semanas a pista abajo una filtración de memoria causada por *Google *Analytics 
antes de que podría liberar mi primer *app.  Creo *MAT me ayudó encuentra la evidencia 
crucial. 

Tiene el resto de ti encontrado que siguiendo los vínculos, árboles, informes, y *histograms 
en Memoria *Analyzer es útil? Parece gusta allí *ought para 
ser algunas pistas en allí, pero estoy consiguiendo mayoritariamente ventajas falsas.  

*Otherwise Estoy utilizando *Treking método. Imposibilitando bits de funcionalidad a la vez. 
 

Nathan

En martes, septiembre 16, 2014 5:56:48 SOY *UTC-7, Calles De *Boston escribió:
>
> tuve un asunto similar una vez y yo *tracked lo abajo a la Vista#*setTag(*int 
> llave, Objeto *tag) método.
> En mi código, *setTag fue llamado con un *tag el valor que es un holding 
> de objeto/*referencing un caso que tuvo niños *referring a niños de la 
> Vista en el cual este *setTag fue llamado (*tag era un '*ViewHolder' 
> caso). 
>
> Versiones seguras de *Android implementa *setTag utilizando un **static *mapa de *WeakRereferences. 
> Esto causó una Vista a nunca conseguir la basura recogida, desde 
> el *tag aguantaría referencias a sus niños *whose padres  entonces 
> punto (completamente arriba de) a aquella Vista otra vez. Y si una Vista no consigue 
> la basura recogida, su Contexto (*i.*e. Actividad) nunca conseguiría la basura 
> recogió.
>
> Mirada si hay cualquier cosa aguantando encima a vuestra Actividad por la virtud de otros 
> casos que son aguantado #por *incorrect uso de *WeakReferences.
>
>
> En miércoles, septiembre 10, 2014 12:00:36 SOY *UTC-4, Nathan escribió:
>>
>> soy *fairly seguro he sido capaz de utilizar el *eclipse herramientas antes de que a pista 
>> abajo filtraciones de memoria - yo incluso encontrado uno en *Google *Analytics. 
>>
>> Pero puedo no para la vida de mí imagina fuera.
>>
>> He descubierto que hay dos casos de Actividad *B en memoria 
>> cuándo la actividad es cerrada. Puedo ver que con sé 
>>
>> bastante para saber que aquello es mal. 
>>
>> Pero lo que no puedo ver es POR QUÉ. Por qué es que actividad estúpida todavía en memoria 
>> dos veces?
>>
>> Parezco para recordar que yo bien clic en algo y escoger Fusionar Camino 
>> a Raíces de GC. 
>>
>> Entonces consigo algo así. 
>>
>>
>> Nombre 
>> de clase                                                                                       
>> | *Ref. Los Objetos | Superficiales *Heap | *Ref. Superficial *Heap | Retuvo *Heap
>>
>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> *com.*android.Interno.Política.*impl.*PhoneLayoutInflater @ 0*x42*d2*b0*d8 
>> *Unknown                        |            1 |           40 
>> |               536 |            64
>> '- *mPrivateFactory, *mContext *MyActivity @ 0*x42*d28230|            1 
>> |          536 |               536 |       127,336
>> clase *com.*android.Interno.*os.*ZygoteInit @ 0*x41#uno21una18 Clase 
>> de Sistema                               |            1 |          120 
>> |               536 |         1,000
>> '- *mResources *android.Contenido.*res.Recursos @ 
>> 0*x41*aa7108                                         |            1 
>> |          112 |               536 |         8,512
>>    '- *mContext *android.*app.*ContextImpl @ 
>> 0*x43009398                                              |            1 
>> |          128 |               536 |        10,400
>>       '- *mOuterContext *MyActivity @ 0*x42*d4*f008      |            1 
>> |          536 |               536 |         3,864
>>
>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> Bien que *PhoneLayoutInflater no tendría que ser aguantando encima a aquel contexto de una 
>> actividad cerrada, pero no pienso controlo aquello. 
>> Y sin duda que *ZygoteInit la cosa no tendría que ser aguantando un contexto en 
>> un *static manera, pero no controlo que cualquiera. 
>>
>> Cualesquier consejos en encontrar las causas mejores?
>>
>> Nathan
>>
>>
>> Nathan
>>
>

-- 
recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en
*http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
--- 
Recibiste este mensaje porque eres *subscribed al *Google Grupos "*Android *Developers" grupo.
A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx.
Puesto que más opciones, visita *https://grupos.*google.*com/*d/*optout.
Should WeakReferences prevent garbage collection? I thought they were weak 
because they didn't prevent garbage collection. 

I am seeing that some of the Android classes are holding static collections 
of stuff. I can't see where I am causing that behavior, but I keep trying. 

In fact, some of the articles on this topic suggest replacing your 
anonymous inner classes with named, static inner classes that have 
WeakReferences to the outer activity. There are forty of those inner 
classes, with all the clicklisteners and whatnot. It is quite a bit of 
turmoil to change them all, but I may do that. 

All in all, as shown here, these things are often obscure.  
It took me weeks to track down a memory leak caused by Google Analytics 
before I could release my first app.  I believe MAT helped me find the 
crucial evidence. 

Have the rest of you found that following the links, trees, reports, and 
histograms in Memory Analyzer are helpful? it seems like there ought to be 
some clues in there, but I am getting mostly false leads.  

Otherwise I am using Treking's method. Disabling bits of functionality at a 
time. 

Nathan

On Tuesday, September 16, 2014 5:56:48 AM UTC-7, Streets Of Boston wrote:
>
> I had a similar issue once and I tracked it down to the View#setTag(int 
> key, Object tag) method.
> In my code, setTag was called with a tag value being an object 
> holding/referencing an instance that had children referring to children of 
> the View on which this setTag was called (tag was a 'ViewHolder' 
> instance). 
>
> Certain versions of Android implement setTag using a *static *map of 
> WeakRereferences. This caused a View to never get garbage collected, since 
> the tag would hold references to its children whose parents would then 
> point (all the way up) to that View again. And if a View doesn't get 
> garbage collected, its Context (i.e. Activity) would never get garbage 
> collected.
>
> Look if there is anything holding on to your Activity by the virtue of 
> other instances being held through incorrect usage of WeakReferences.
>
>
> On Wednesday, September 10, 2014 12:00:36 AM UTC-4, Nathan wrote:
>>
>> I'm fairly sure I have been able to use the eclipse tools before to track 
>> down memory leaks - I even found one in Google Analytics. 
>>
>> But I can't for the life of me figure out.
>>
>> I have found out that there are two instances of Activity B in memory 
>> when the activity is closed. I can see that with 
>>
>> I know enough to know that that is bad. 
>>
>> But what I cannot see is WHY. Why is that stupid activity still in memory 
>> twice?
>>
>> I seem to remember that I right click on something and choose Merge Path 
>> to GC Roots. 
>>
>> Then I get something like this. 
>>
>>
>> Class 
>> Name                                                                                       
>> | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
>>
>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> com.android.internal.policy.impl.PhoneLayoutInflater @ 0x42d2b0d8 
>> Unknown                        |            1 |           40 
>> |               536 |            64
>> '- mPrivateFactory, mContext MyActivity @ 0x42d28230|            1 
>> |          536 |               536 |       127,336
>> class com.android.internal.os.ZygoteInit @ 0x41a21a18 System 
>> Class                               |            1 |          120 
>> |               536 |         1,000
>> '- mResources android.content.res.Resources @ 
>> 0x41aa7108                                         |            1 
>> |          112 |               536 |         8,512
>>    '- mContext android.app.ContextImpl @ 
>> 0x43009398                                              |            1 
>> |          128 |               536 |        10,400
>>       '- mOuterContext MyActivity @ 0x42d4f008      |            1 
>> |          536 |               536 |         3,864
>>
>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> Well that PhoneLayoutInflater shouldn't be holding on to that context of 
>> a closed activity, but I don't think I control that. 
>> And definitely that ZygoteInit thing shouldn't be holding a context in a 
>> static way, but I don't control that either. 
>>
>> Any tips on finding the causes better?
>>
>> Nathan
>>
>>
>> Nathan
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
For more options, visit https://groups.google.com/d/optout.
<Anterior por Tema] Tema Actual [Siguiente por Tema>