Index: sql/connection.h |
diff --git a/sql/connection.h b/sql/connection.h |
index 19592d9f0e44ed68764b9d25a88d9a65424ba9b7..0263bb1cedce5c3a220e643d8b786536f7214ec5 100644 |
--- a/sql/connection.h |
+++ b/sql/connection.h |
@@ -262,6 +262,7 @@ class SQL_EXPORT Connection { |
// true, this function will try to free all of the cache memory it can. If |
// |aggressively| is false, this function will try to cut cache memory |
// usage by half. |
+ // NOTE(shess): See also ReleaseCacheMemory(). |
rmcilroy
2015/09/17 17:17:44
Not sure this comment is needed given ReleaseCache
Scott Hess - ex-Googler
2015/09/17 21:14:37
I believe sqlite3_db_release_memory() should match
|
void TrimMemory(bool aggressively); |
// Raze the database to the ground. This approximates creating a |
@@ -638,6 +639,12 @@ class SQL_EXPORT Connection { |
return clock_->Now(); |
} |
+ // Release page-cache memory if memory-mapped I/O is enabled and the database |
+ // was changed. Passing true for |assume_changed| allows overriding the |
+ // change detection for cases like DDL (CREATE, DROP, etc), which do not |
+ // participate in the total-rows-changed tracking. |
+ void ReleaseCacheMemoryIfNeeded(bool assume_changed); |
+ |
// The actual sqlite database. Will be NULL before Init has been called or if |
// Init resulted in an error. |
sqlite3* db_; |
@@ -679,6 +686,14 @@ class SQL_EXPORT Connection { |
// databases. |
bool poisoned_; |
+ // |true| if SQLite memory-mapped I/O is enabled for this connection. |
+ // Used by ReleaseCacheMemoryIfNeeded(). |
+ bool mmap_enabled_; |
+ |
+ // Used by ReleaseCacheMemoryIfNeeded() to track if new changes have happened |
+ // since memory was last released. |
+ int total_changes_; |
Scott Hess - ex-Googler
2015/09/17 21:14:37
I changed this to |total_changes_last_release_| to
rmcilroy
2015/09/18 11:16:29
How about total_changes_since_last_release_ for cl
Scott Hess - ex-Googler
2015/09/21 18:08:57
total_changes_at_last_release_, as this is an abso
|
+ |
ErrorCallback error_callback_; |
// Tag for auxiliary histograms. |