baka_bai wrote:After querying a db file and assigning my results to a wxSQLite3ResultsSet object how would I clear the results?
Memory is cleaned up when the wxSQLite3ResultsSet object goes out of scope, when you explicitly call its method Finalize, or when you assign a new value.
baka_bai wrote:Could I get away with doing something like this:
Code: Select all
void DBClass::ClearResults() {
delete m_results; //m_results private variable
}
or will that cause a memory leak?
No.
baka_bai wrote:Or can I just reasign a new query to m_results?
Yes.
baka_bai wrote:The reason I ask this would be because the user, in my app, may sometimes not require the viewing of all results sent back in my app. So I do not want any wasted memory if a search of the database my not happen again for a duration of time.
Do whatever is most appropriate in your application, that is, explicitly call Finalize, assign a new value or delete the result set. wxSQLite3 takes care of cleaning up the memory allocated by SQLite.
Regards,
Ulrich