Samba 2.0.7 mem leaks, continued

Jeremy Allison jeremy at
Thu Sep 14 19:00:10 GMT 2000

acherry at wrote:

> Since the dbx leak checking I did seemed to point to the
> hash_table_init() function in lib/hash.c, I did some poking around to
> see what the problem was.  At least one problem is that there's a
> hash_clear() function to free up the memory used by a table, but it
> never gets referenced anywhere. :-) Send the smbd daemon enough HUP
> signals and this will become noticeable as the old stat_cache is
> thrown away each time (more noticeable in the long run).
> I've gotten around this by running hash_table_clear(&stat_cache) in
> smbd/filename.c just before running hash_table_init().  But even after
> doing that, the smbd daemon process still seemes to be gaining about
> 8K per hour (though an improvement over before)... I'm not yet sure
> where that memory is going -- I haven't been able to reproduce it in a
> test environment, and I want to keep the testing/experimentation off
> of our production server.

Ok - can you try this patch for 2.0.7 which is what we have added
to 2.2.0 to fix the statcache problems. Let me know if it fixes


	Jeremy Allison,
	Samba Team.

Index: smbd/filename.c
RCS file: /data/cvs/samba/source/smbd/filename.c,v
retrieving revision
diff -u -r1. filename.c
--- smbd/filename.c     2000/03/16 22:59:44
+++ smbd/filename.c     2000/09/14 18:57:18
@@ -734,5 +734,13 @@
 BOOL reset_stat_cache( void )
-  return hash_table_init( &stat_cache, INIT_STAT_CACHE_SIZE, (compare_function)(strcmp));
+       static BOOL initialised;
+       if (!lp_stat_cache()) return True;
+       if (!initialised) {
+               initialised = True;
+               return hash_table_init( &stat_cache, INIT_STAT_CACHE_SIZE, (compare_function)(strcmp));
+       }
+       hash_clear(&stat_cache);
+       return True;
 } /* reset_stat_cache  */                               
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.

More information about the samba-technical mailing list