Vincent Tsao's Library tagged → View Popular, Search in Google
Apr
24
2010
-
As part of my job, I ran into memory leaks issues in Android applications and they are most of the time due to the same mistake: keeping a long-lived reference to a
Context. -
There are two easy ways to avoid context-related memory leaks. The most obvious one is to avoid escaping the context outside of its own scope. The example above showed the case of a static reference but inner classes and their implicit reference to the outer class can be equally dangerous. The second solution is to use the
Applicationcontext. This context will live as long as your application is alive and does not depend on the activities life cycle. If you plan on keeping long-lived objects that need a context, remember the application object. You can obtain it easily by callingContext.getApplicationContext()orActivity.getApplication(). - 1 more annotation(s)...
1 - 5 of 5
Showing 20▼ items per page
Top Contributors
Related Lists on Diigo
-
Android
This list contains all links...
Items: 50 | Visits: 2
Created by: leowarrior
-
EurekaLab | EurekaLog | Delphi, C++Builder, C# and VB.NET Exception trapper
EurekaLab | EurekaLog - Delp...
Items: 12 | Visits: 2
Created by: secure downloads
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
