[Dnsmasq-discuss] Potential memory leak

Simon Kelley simon at thekelleys.org.uk
Fri Jan 23 13:18:52 UTC 2026


This behaviour is not generally seen, so there has to be something about 
Opensense installation which is unusual. That could be the FreeBSD 
kernel and/or libraries, or it could be something in the dnsmasq 
configuration.

I just looked through the 2.92 changelog and the only memory leak that 
has been fixed since 2.91 is in the inotify code, which isn't included 
on FreebSD in 2.91.

I've just spent a while staring at the dnsmasq code that's unique to 
*BSD, and it's pretty difficult to see a memory leak there. It most 
doesn't allocate memory and where it does the code paths for free it 
again are straightforward.

As far as configuration is concerned, there are few thinks to suspect 
a-priori.

Does the Opensense setup prod dnsmasq to re-read it's configuration 
files regularly? That code has historically memory-leak prone.

Does the network interface change often? Creating and deleting 
interfaces/addresses/routes etc. If dnsmasq is running its routines to 
adapt to such changes often, that might expose a memory leak. Are you 
running --bind-interfaces or --bind-dynamic?

Since I can't really reproduce this here, and you can see it at will: it 
would be useful for you to get me as much information as you can. I'll 
certainly need complete dnsmasq logs: set

log-queries=extra
log-dhcp
log-facility=/path/to/file

in the config

and remove the quiet-* options that are there now.

If you can, and have enough file storage, a log file which logs the RSS 
of the dnsmasq  process every second might be a great way to correlate 
stuff happening in the logs with RSS expansion.


Cheers,

Simon.





On 22.01.2026 15:33, Niten Jaiswal wrote:
> The configuration below has dnsmasq’s RA feature turned off.  If I turn 
> off radvd and turn on dnsmasq’s RA feature the same behavior occurs.
> 
> *From: *Dnsmasq-discuss <dnsmasq-discuss- 
> bounces at lists.thekelleys.org.uk> on behalf of Simon Kelley 
> <simon at thekelleys.org.uk>
> *Date: *Thursday, January 22, 2026 at 10:30 AM
> *To: *dnsmasq-discuss at lists.thekelleys.org.uk <dnsmasq- 
> discuss at lists.thekelleys.org.uk>
> *Subject: *Re: [Dnsmasq-discuss] Potential memory leak
> 
>  From the mailing list:
> 
> "Here's something interesting... it looks like there is a problem with
> serving DHCPv6... so after turning on radvd memory consumption started
> increasing substantially..."
> 
> How does that alter the configuration below?
> 
> 
> Simon.
> 
> On 22.01.2026 14:05, Niten Jaiswal via Dnsmasq-discuss wrote:
>  > I’m running version 2.91_1.1 on opnsense version 25.7.10.  Below is my
>  > configuration:
>  >
>  > OPNsense:~ # cat /usr/local/etc/dnsmasq.conf
>  >
>  > # DO NOT EDIT THIS FILE -- OPNsense auto-generated file
>  >
>  > #
>  >
>  >
>  > rebind-localhost-ok
>  >
>  > stop-dns-rebind
>  >
>  >
>  > port=5353
>  >
>  >
>  > # If you want dnsmasq to listen for DHCP and DNS requests only on
>  >
>  > # specified interfaces (and the loopback) give the name of the
>  >
>  > # interface (eg eth0) here.
>  >
>  > # Repeat the line for more than one interface.
>  >
>  > interface=ixl1
>  >
>  >
>  >
>  >
>  > dhcp-fqdn
>  >
>  > domain=375.jaiswal.net
>  >
>  > # This tells dnsmasq that a domain is local and it may answer queries
>  > from /etc/hosts
>  >
>  > # or DHCP but should never forward queries on that domain to any
>  > upstream servers.
>  >
>  > local=/375.jaiswal.net/
>  >
>  >
>  > dhcp-authoritative
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  > log-dhcp
>  >
>  > quiet-dhcp
>  >
>  > quiet-dhcp6
>  >
>  > quiet-ra
>  >
>  > quiet-tftp
>  >
>  >
>  >
>  > # host entries flushed via dnsmasq_watcher.py [isc] and a dump of the
>  > static reservations
>  >
>  > addn-hosts=/var/etc/dnsmasq-hosts
>  >
>  > addn-hosts=/var/etc/dnsmasq-leases
>  >
>  >
>  > dns-forward-max=15000
>  >
>  > cache-size=10000
>  >
>  > local-ttl=1
>  >
>  >
>  > conf-dir=/usr/local/etc/dnsmasq.conf.d,*.conf
>  >
>  >
>  > dhcp-range=tag:ixl1,X.X.X.30,X.X.X.199,86400
>  >
>  >
>  > domain=375.jaiswal.net,X.X.X.30,X.X.X.199
>  >
>  > dhcp-range=tag:ixl1,::1000,::2000,constructor:ixl1,64,86400
>  >
>  >
>  > domain=X.X.X,::1000,::2000
>  >
>  >
>  > dhcp-host=d8:0d:17:41:af:2c,X.X.X.23,TL-SG108PE
>  >
>  > dhcp-host=68:1d:ef:18:b2:c6,X.X.X.29,camect-home-2fefa
>  >
>  > dhcp-host=dc:f5:05:18:4e:fb,X.X.X.34,mwmdemo-4EFB
>  >
>  > dhcp-host=1c:1d:d3:d8:23:e6,X.X.X.35,Nitens-Mac-Studio
>  >
>  > dhcp-host=a8:51:ab:02:3f:28,X.X.X.99,Guest_Room_AppleTV
>  >
>  > dhcp-host=00:1a:ae:00:40:4b,X.X.X.101
>  >
>  > dhcp-host=00:1a:ae:02:5f:16,X.X.X.113
>  >
>  > dhcp-host=88:c9:e8:bc:e9:50,X.X.X.116,Sony_A95K_FM
>  >
>  > dhcp-host=60:81:f9:ac:66:58,X.X.X.128,Helium-Hotspot
>  >
>  > dhcp-host=00:0c:d0:01:23:33,X.X.X.132
>  >
>  > dhcp-host=b8:2c:a0:5b:5d:14,X.X.X.142,android-a3369b84877d627a
>  >
>  > dhcp-host=80:a5:89:aa:42:67,X.X.X.152,mwmdemo-4267
>  >
>  > dhcp-host=90:56:82:98:56:c2,X.X.X.201,AmanBluesound
>  >
>  > dhcp-host=18:bb:26:e2:2f:43,X.X.X.202,RianBluesound
>  >
>  > dhcp-host=90:56:82:40:91:49,X.X.X.203,MasterBedroom
>  >
>  > dhcp-host=64:95:6c:0a:94:76,X.X.X.204,LG_Projector_MB
>  >
>  > dhcp-host=38:c9:86:14:8b:ae,X.X.X.205,10ddb198e7550000
>  >
>  > dhcp-host=20:f8:5e:4e:b5:d6,X.X.X.206,RianBedroomFan
>  >
>  > dhcp-host=20:f8:5e:4e:ac:37,X.X.X.207,AmanBedroomFan
>  >
>  > dhcp-host=20:f8:5e:35:e4:5c,X.X.X.208,MasterBedroomFa
>  >
>  > dhcp-host=20:f8:5e:4e:ce:5a,X.X.X.209,FamilyRoomFan
>  >
>  > dhcp-host=20:f8:5e:e4:44:ce,X.X.X.210,OfficeFan
>  >
>  > dhcp-host=00:11:d9:56:96:45,X.X.X.211,TIVO-A9200019027F13F
>  >
>  > dhcp-host=20:f8:5e:4e:ad:57,X.X.X.212,PlayRoomFan
>  >
>  > dhcp-host=00:1b:7c:09:81:9f,X.X.X.213,sdr35-589374
>  >
>  > dhcp-host=00:11:d9:8f:15:09,X.X.X.214,TIVO-849601190366E67
>  >
>  > dhcp-host=14:91:82:d8:4b:70,X.X.X.221,Wemo_soffit
>  >
>  > dhcp-host=00:1b:7c:09:81:b1,X.X.X.222,sdp55-58b1f0
>  >
>  > dhcp-host=d4:6a:91:0e:88:d2,X.X.X.223,Wattbox
>  >
>  > dhcp-host=ec:a9:07:10:7a:50,X.X.X.224,AppleTVvingRoom
>  >
>  > dhcp-host=4c:ab:4f:90:c6:47,X.X.X.225,AppleTVmilyRoom
>  >
>  > dhcp-host=c8:d0:83:ca:46:cc,X.X.X.226,MasterBAppleTV3
>  >
>  > dhcp-host=00:11:d9:96:e8:9a,X.X.X.227,TIVO-84900119048F1A6
>  >
>  > dhcp-host=id:00:01:00:01:2d:af:54:ce:b8:e6:0c:13:e7:1e,
>  > [::b9cc],m1_macbook_pro
>  >
>  > dhcp-host=id:00:04:bb:36:4d:56:f5:2c:9f:11:50:7a:32:82:60:23:dd:e1,
>  > [::bbc1],pi-hole
>  >
>  > dhcp-host=id:00:01:00:01:29:42:4e:a4:14:98:77:7b:27:6d,[::bbc2],mac-
>  > mini-server
>  >
>  > dhcp-host=id:00:01:00:01:2e:ea:7c:b5:00:1a:1e:04:13:98, 
> [::bbc3],aruba-master
>  >
>  > dhcp-host=id:00:01:00:01:2e:ea:7c:b5:00:1a:1e:04:13:98,[::bbc3],aruba-
>  > conductor
>  >
>  >
>  > dhcp-option=tag:ixl1,60,ArubaAP
>  >
>  > dhcp-option=tag:ixl1,43,X.X.X.2
>  >
>  > dhcp-option=tag:ixl1,66,X.X.X.10
>  >
>  > dhcp-option=tag:ixl1,150,X.X.X.10
>  >
>  > dhcp-option=42,X.X.X.1
>  >
>  > dhcp-option=tag:ixl1,6,X.X.X.4
>  >
>  > dhcp-option=tag:ixl1,option6:23,[::bbc1]
>  >
>  >
>  > # default dns mapped to this server (0.0.0.0)
>  >
>  > dhcp-option=6,0.0.0.0
>  >
>  >
>  >
>  > no-ident
>  >
>  >
>  >
>  > *From: *Dnsmasq-discuss <dnsmasq-discuss-
>  > bounces at lists.thekelleys.org.uk> on behalf of Niten Jaiswal via Dnsmasq-
>  > discuss <dnsmasq-discuss at lists.thekelleys.org.uk>
>  > *Date: *Tuesday, January 20, 2026 at 9:53 PM
>  > *To: *dnsmasq-discuss at lists.thekelleys.org.uk <dnsmasq-
>  > discuss at lists.thekelleys.org.uk>
>  > *Subject: *[Dnsmasq-discuss] Potential memory leak
>  >
>  > Hi!
>  > I’m a user of opnsense and have migrated to dnsmasq for DHCPv4 and v6
>  > services.  However, dnsmasq randomly stops functioning and I need to
>  > manually restart it to restore DHCP services to my network.  I’ve been
>  > troubleshooting the issue on the opnsense form on the following thread:
>  > https://forum.opnsense.org/index.php?topic=49552.30 <https:// 
> forum.opnsense.org/index.php?topic=49552.30> <https://
>  > forum.opnsense.org/index.php?topic=49552.30>
>  >
>  > My basic testing points to an issue with serving DHCPv6 addresses.  When
>  > I have router advertisement set to unmanaged the memory consumption of
>  > dnsmasq was fairly stable.  When router advertisement is set to managed
>  > then dnsmasq begins consuming more and more memory..
>  >
>  > Let me know if you need additional information.  I was asked to post to
>  > the email list by an opnsense forum moderator.
>  >
>  > TIA
>  > Niten
>  >
>  > _______________________________________________
>  > Dnsmasq-discuss mailing list
>  > Dnsmasq-discuss at lists.thekelleys.org.uk
>  > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq- 
> discuss <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/ 
> dnsmasq-discuss>
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss 
> <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss>




More information about the Dnsmasq-discuss mailing list