evolution-data-server r9145 - trunk/camel



Author: sragavan
Date: Sun Jul 20 17:25:42 2008
New Revision: 9145
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9145&view=rev

Log:
Added few environment variables to enable memory reduction code.
CDS_DEBUG = strict pstring free.
CAMEL_FREE_INFOS = free message infos at intervals.
CAMEL_SQLITE_FREE_CACHE = free sqlite cache at intervals
CAMEL_SQLITE_SHARED_CACHE = enable share cache for multiple threads.


Modified:
   trunk/camel/camel-db.h
   trunk/camel/camel-folder-summary.c
   trunk/camel/camel-string-utils.c

Modified: trunk/camel/camel-db.h
==============================================================================
--- trunk/camel/camel-db.h	(original)
+++ trunk/camel/camel-db.h	Sun Jul 20 17:25:42 2008
@@ -15,8 +15,8 @@
 
 #define CAMEL_DB_FREE_CACHE_SIZE 2 * 1024 * 1024
 #define CAMEL_DB_SLEEP_INTERVAL 1*10*10
-#define CAMEL_DB_RELEASE_SQLITE_MEMORY if(!g_getenv("CAMEL_SQLITE_PRESERVE_CACHE")) sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
-#define CAMEL_DB_USE_SHARED_CACHE if(!g_getenv("CAMEL_SQLITE_SHARED_CACHE_OFF")) sqlite3_enable_shared_cache(TRUE);
+#define CAMEL_DB_RELEASE_SQLITE_MEMORY if(g_getenv("CAMEL_SQLITE_FREE_CACHE")) sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
+#define CAMEL_DB_USE_SHARED_CACHE if(g_getenv("CAMEL_SQLITE_SHARED_CACHE")) sqlite3_enable_shared_cache(TRUE);
 
 
 /* The extensive DB format, supporting basic searching and sorting

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Sun Jul 20 17:25:42 2008
@@ -833,7 +833,8 @@
 	s->cache_load_time = time (NULL);
 
         #warning "LRU please and not timeouts"
-	s->timeout_handle = g_timeout_add_seconds (SUMMARY_CACHE_DROP, (GSourceFunc) cfs_try_release_memory, s);
+	if (g_getenv("CAMEL_FREE_INFOS")) 
+		s->timeout_handle = g_timeout_add_seconds (SUMMARY_CACHE_DROP, (GSourceFunc) cfs_try_release_memory, s);
 
 	return ret == 0 ? 0 : -1;
 }

Modified: trunk/camel/camel-string-utils.c
==============================================================================
--- trunk/camel/camel-string-utils.c	(original)
+++ trunk/camel/camel-string-utils.c	Sun Jul 20 17:25:42 2008
@@ -240,15 +240,19 @@
 		if (count == 0) {
 			g_hash_table_remove(pstring_table, p);
 			g_free(p);
-			if (p != s) /* Only for debugging purposes */
-				g_assert(0);
+			if (g_getenv("CDS_DEBUG")) { 
+				if (p != s) /* Only for debugging purposes */
+					g_assert(0);
+			}
 		} else {
 			g_hash_table_insert(pstring_table, p, GINT_TO_POINTER(count));
 		}
 	} else {
-		g_warning("Trying to free string not allocated from the pool '%s'", s);
-		/*Only for debugging purposes */
-		g_assert (0);
+		if (g_getenv("CDS_DEBUG")) {
+			g_warning("Trying to free string not allocated from the pool '%s'", s);
+			/*Only for debugging purposes */
+			g_assert (0);
+		}
 	}
 	pthread_mutex_unlock(&pstring_lock);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]