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 <a...@funkyandroid.com> 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.
>>
>>
>>     
>
> >
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to