diff --git a/src/server/ramkomd.c b/src/server/ramkomd.c
index ba50808d652964eea1ed7ae1edb5e6c10cb2bcb9..9851667599cf94e54744480628e91f1bb5f69d32 100644
--- a/src/server/ramkomd.c
+++ b/src/server/ramkomd.c
@@ -52,7 +52,7 @@ EXPORT char backupfilename[1024]; /* Full pathname to the backup file */
 EXPORT char textfilename[1024];	/* Full pathname to the text file. */
 EXPORT char statisticfile[1024];	/* Dito to statistics file. */
 EXPORT char pidfile[1024];		/* Dito pid-file. */
-INTERNAL char memusefile[1024];		/* Memory useage file. */
+INTERNAL char memusefile[1024];		/* Memory usage file. */
 
 char ip_client_port[80];        /* Port to listen to for clients */
 char ip_mux_port[80];           /* Port to listen to for mux:es */
@@ -255,16 +255,20 @@ main (int    argc,
 
     logout_all_clients();
     cache_sync_all();
-    free_all_tmp();
-    free_all_cache();
 
     stat_file = fopen(memusefile, "w");
 
     if ( stat_file == NULL )
 	restart_kom("Can't open file to save memory usage to.\n");
 
+    dump_cache_stats (stat_file);
+
+    free_all_tmp();
+    free_all_cache();
+
     dump_smalloc_counts(stat_file);
     dump_alloc_counts(stat_file);
+    dump_cache_mem_usage(stat_file);
 
     fclose (stat_file);