Static references are cleared–does Android unload classes at runtime if unused?

Both you (@Matthias) and Mark Murphy (@CommonsWare) are correct in what you say, but the gist seems lost. (The use of volatile is correct and classes are not unloaded.) The crux of the question is where initialize is called from. Here is what I think is happening: You are calling initialize from an Activity * … Read more

What’s the purpose of GC.SuppressFinalize(this) in Dispose() method?

When implementing the dispose pattern you might also add a finalizer to your class that calls Dispose(). This is to make sure that Dispose() always gets called, even if a client forgets to call it. To prevent the dispose method from running twice (in case the object already has been disposed) you add GC.SuppressFinalize(this);. The … Read more

How do I get .NET to garbage collect aggressively?

Here are some articles detailing problems with the Large Object Heap. It sounds like what you might be running into. http://connect.microsoft.com/VisualStudio/feedback/details/521147/large-object-heap-fragmentation-causes-outofmemoryexception Dangers of the large object heap: http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/ Here is a link on how to collect data on the Large Object Heap (LOH): http://msdn.microsoft.com/en-us/magazine/cc534993.aspx According to this, it seems there is no way to compact … Read more