Garbage collection?

Glenn Satchell Glenn.Satchell at
Wed Sep 9 00:41:46 UTC 2009

>Date: Tue, 8 Sep 2009 16:58:27 -0500
>From: Peter Laws <plaws at>
>To: Users of ISC DHCP <dhcp-users at>
>Subject: Garbage collection?
>Get this every hour:
>Sep  8 16:02:21 $HOST dhcpd: Wrote 0 deleted host decls to leases file.
>Sep  8 16:02:21 $HOST dhcpd: Wrote 0 new dynamic host decls to leases file.
>Sep  8 16:02:21 $HOST dhcpd: Wrote 24118 leases to leases file.
> From watching the number of leases outstanding (using some perl script I 
>found somewhere), it appears that this is DHCPD going through and expiring 
>leases that it otherwise assumed were in use.  I.e., before the process 
>runs, the lease total is much higher than right after it runs.
>I've looked at dhcpd(8), dhcpd.conf(5), and dhcpd.leases(5) and find 
>nothing relevant.
>With the students back (all of whom apparently have iPhones!) we're getting 
>very close to the WiFi pool's max size.
>While we work on a long-term fix for that, what can I do to get that 
>cleanup process to run more frequently so that we aren't as likely to run 
>out of addresses?

Hi Peter

dhcpd.leases is an "append-only" record of leases, so each time the
lease is modifie, eg respond to DHCPDISCOVER or DHCPREQUEST a new
record is added to the end of the file. If you look through the file
you will often see many records for the same IP address. Only the last
one is the current status.

Every hour or so dhcpd re-writes the leases file with only the last
record for each lease. This helps keep the file from growing too big.

Internally dhcpd keeps a record of all leases in memory, and this in
memory list is continually updated as leases expire, are renewed, or
new ones are issued.

So the garbage collection you see is only dhcpd tidying up the leases

This is from the dhcpd.leases man page:

     Every  time  a lease is acquired, renewed or
     released, its new value is recorded at the end of the  lease
     file.   So  if more than one declaration appears for a given
     lease, the last one in the file is the current one.

     In order to prevent the lease database from growing  without
     bound,  the  file is rewritten from time to time.

By the way dhcpd-3.0.1 is very old, released in July 2004, so you
should think about an upgrade. But then I see you are running RedHat 3,
so perhaps there is more than a dhcpd upgrade required? :)

Glenn Satchell   mailto:glenn.satchell at | Miss 9: What do you
Uniq Advances Pty Ltd | do at work Dad?
PO Box 70 Paddington NSW Australia 2021            | Miss 6: He just
tel:0409-458-580     fax:02-9380-6416              | types random stuff.

More information about the dhcp-users mailing list