On Tue, Mar 29, 2011 at 10:57 AM, Mark Murphy <[email protected]>wrote:
> On Tue, Mar 29, 2011 at 1:43 PM, Kostya Vasilyev <[email protected]> > wrote: > >>> > There is no leaked database connection with Content Providers. > >> > >> Yes, there is, at least by my definition (close() not being called). > > > > By this definition, every program running in a non-GC environment has a > > memory leak, which would be a very interesting point of view. > I never said a memory leak. I said a leaked database connection. > > To me, a leak is where the use of some resource grows over time and has > no > > chance of decreasing. The resource in question may be memory, open files, > > DMA buffers, etc. > To me, a leak is something that is allocated and not released. The > "release" could be manually (e.g., calling close()) or automatically > (e.g., finalizers in a GC environment). > "leak" is the wrong word for this, as it implies a bug or undesirable behavior. This is not the case. Android made a deliberate design decision that is can seem surprising, to just give up on the whole idea of applications cleanly exiting and instead let the kernel clean up their resources. After all, the kernel needs to be able to do this anyway. Given that design, keeping *anything* open for the entire duration of a process's life and never closing it is simply not a leak. It will be cleaned up when the process is cleaned up. It is only a leak if you are opening something and not closing it (or freeing it) after you are done with it... in really this means that you can create/allocate it an arbitrary number of times for the life of the process, but are not releasing those instances, causing your resource usage to grow without bound. -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

