A content provider is created as part of its process being initialized, and
remains for the lifetime of the process, so they don't really have a
lifecycle on their own.

On Sun, Jan 25, 2009 at 1:03 PM, Al Sutton <[email protected]> wrote:

>
> But my question is who does close the database reference?
>
> The SQLiteOpenHelper javadoc says "Make sure to call close()
> <
> http://code.google.com/android/reference/android/database/sqlite/SQLiteOpenHelper.html#close%28%29
> >
> when you no longer need it.", but the ContentProvider appears not to do
> this as it has no finalize method. So is the javadoc wrong, or should
> there be a close in a finalize method?
>
> Al.
>
>
> Jeff Hamilton wrote:
> > The helper gives you a reference to an existing open database, and
> > clients of the helper should not close the databases they get from it.
> >
> > -Jeff
> >
> > On Sun, Jan 25, 2009 at 2:48 AM, Al Sutton <[email protected]> wrote:
> >
> >> Looking through android.content.SearchRecentSuggestionsProvider.java
> >> there are several methods (insert, delete, query,...) which get a
> >> SQLiteDatabase object from the helper but don't close them.
> >>
> >> Wouldn't this cause a memory leak?
> >>
> >> Al.
> >>
> >> --
> >> ======
> >> Funky Android Limited is registered in England & Wales with the
> >> company number  6741909. The registered head office is Kemp House,
> >> 152-160 City Road, London,  EC1V 2NX, UK.
> >>
> >> The views expressed in this email are those of the author and not
> >> necessarily those of Funky Android Limited, it's associates, or it's
> >> subsidiaries.
> >>
> >>
> >>
> >
> > >
> >
>
>
> >
>


-- 
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.  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-framework" 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-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to