Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

java - android disadvantages of not closing cursor

I have some questions regarding Cursor.

I want to know what are the disadvantages of not closing a Cursor?

It deallocates resources, but what resources are deallocated?

If we do not close the Cursor? What will be the consequences and to what extent?

Not closing a Cursor does not affect Activity a bit, but it gives error in a log cat.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Closing a Cursor will avoid any potential memory leaks, so YES they should always be closed when no longer used.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...