<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Simon,</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I’ve started monitoring.  Logging is enabled and I’m using the following command to capture memory usage.</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
sh -c 'while true; do echo `date`; ps -p `cat /var/run/dnsmasq.pid` -o pid,pcpu,rss,vsz,comm; sleep 1; done' >> dns_mem_usage.out</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Niten</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="mail-editor-reference-message-container">
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr;">
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
<b>From: </b>Dnsmasq-discuss <dnsmasq-discuss-bounces@lists.thekelleys.org.uk> on behalf of Niten Jaiswal via Dnsmasq-discuss <dnsmasq-discuss@lists.thekelleys.org.uk><br>
<b>Date: </b>Wednesday, January 28, 2026 at 2:48 PM<br>
<b>To: </b>Simon Kelley <simon@thekelleys.org.uk>, dnsmasq-discuss@lists.thekelleys.org.uk <dnsmasq-discuss@lists.thekelleys.org.uk><br>
<b>Subject: </b>Re: [Dnsmasq-discuss] Potential memory leak<br>
<br>
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
HI Simon,</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I’m not sure if I can run your version on opnsense.  The opnsense team gave me a patch to install that will remove the quiet options and have shown me how to enable the logging you requested.  I will turn everything on later today.</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="mail-editor-reference-message-container">
<div class="ms-outlook-mobile-reference-message skipProofing" style="direction: ltr;">
<meta name="Generator" content="Microsoft Exchange Server">
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
<b>From: </b>Simon Kelley <simon@thekelleys.org.uk><br>
<b>Date: </b>Wednesday, January 28, 2026 at 11:17 AM<br>
<b>To: </b>Niten Jaiswal <niten@jaiswal.net>, dnsmasq-discuss@lists.thekelleys.org.uk <dnsmasq-discuss@lists.thekelleys.org.uk><br>
<b>Subject: </b>Re: [Dnsmasq-discuss] Potential memory leak<br>
<br>
</div>
<div class="PlainText" style="font-size: 11pt;">I've just pushed some changes to the git repo, whichinclude a new option<br>
called --log-malloc. If you can run that code, and enable log-malloc and<br>
save the log file, that might be interesting. There will be a reasonable<br>
amount of activity after startup, but once the various tables reach<br>
equilibrium size, it should be pretty quiet. If it's not, or there are<br>
some very large allocations, that could give us a clue.<br>
<br>
This has been quite useful: I found a few non-optimal behaviours, which<br>
I've fixed, but nothing that actually leaks memory.<br>
<br>
<br>
Cheers,<br>
<br>
Simon.<br>
<br>
<br>
On 23.01.2026 18:41, Niten Jaiswal wrote:<br>
> HI Simon,<br>
> I don’t believe opnsense forces a re-read of the configuration file on a<br>
> regular basis.  The network interfaces do not regularly change.  They<br>
> have been static since I replaced the network interfaces a few years ago.<br>
><br>
> I’m going to ask the opnsense team how I can adjust the configuration to<br>
> add more logging.  Will reply when I’m ready.<br>
><br>
><br>
><br>
> *From: *Simon Kelley <simon@thekelleys.org.uk><br>
> *Date: *Friday, January 23, 2026 at 8:19 AM<br>
> *To: *Niten Jaiswal <niten@jaiswal.net>, dnsmasq-<br>
> discuss@lists.thekelleys.org.uk <dnsmasq-discuss@lists.thekelleys.org.uk><br>
> *Subject: *Re: [Dnsmasq-discuss] Potential memory leak<br>
><br>
> This behaviour is not generally seen, so there has to be something about<br>
> Opensense installation which is unusual. That could be the FreeBSD<br>
> kernel and/or libraries, or it could be something in the dnsmasq<br>
> configuration.<br>
><br>
> I just looked through the 2.92 changelog and the only memory leak that<br>
> has been fixed since 2.91 is in the inotify code, which isn't included<br>
> on FreebSD in 2.91.<br>
><br>
> I've just spent a while staring at the dnsmasq code that's unique to<br>
> *BSD, and it's pretty difficult to see a memory leak there. It most<br>
> doesn't allocate memory and where it does the code paths for free it<br>
> again are straightforward.<br>
><br>
> As far as configuration is concerned, there are few thinks to suspect<br>
> a-priori.<br>
><br>
> Does the Opensense setup prod dnsmasq to re-read it's configuration<br>
> files regularly? That code has historically memory-leak prone.<br>
><br>
> Does the network interface change often? Creating and deleting<br>
> interfaces/addresses/routes etc. If dnsmasq is running its routines to<br>
> adapt to such changes often, that might expose a memory leak. Are you<br>
> running --bind-interfaces or --bind-dynamic?<br>
><br>
> Since I can't really reproduce this here, and you can see it at will: it<br>
> would be useful for you to get me as much information as you can. I'll<br>
> certainly need complete dnsmasq logs: set<br>
><br>
> log-queries=extra<br>
> log-dhcp<br>
> log-facility=/path/to/file<br>
><br>
> in the config<br>
><br>
> and remove the quiet-* options that are there now.<br>
><br>
> If you can, and have enough file storage, a log file which logs the RSS<br>
> of the dnsmasq  process every second might be a great way to correlate<br>
> stuff happening in the logs with RSS expansion.<br>
><br>
><br>
> Cheers,<br>
><br>
> Simon.<br>
><br>
><br>
><br>
><br>
><br>
> On 22.01.2026 15:33, Niten Jaiswal wrote:<br>
>  > The configuration below has dnsmasq’s RA feature turned off.  If I turn<br>
>  > off radvd and turn on dnsmasq’s RA feature the same behavior occurs.<br>
>  ><br>
>  > *From: *Dnsmasq-discuss <dnsmasq-discuss-<br>
>  > bounces@lists.thekelleys.org.uk> on behalf of Simon Kelley<br>
>  > <simon@thekelleys.org.uk><br>
>  > *Date: *Thursday, January 22, 2026 at 10:30 AM<br>
>  > *To: *dnsmasq-discuss@lists.thekelleys.org.uk <dnsmasq-<br>
>  > discuss@lists.thekelleys.org.uk><br>
>  > *Subject: *Re: [Dnsmasq-discuss] Potential memory leak<br>
>  ><br>
>  >  From the mailing list:<br>
>  ><br>
>  > "Here's something interesting... it looks like there is a problem with<br>
>  > serving DHCPv6... so after turning on radvd memory consumption started<br>
>  > increasing substantially..."<br>
>  ><br>
>  > How does that alter the configuration below?<br>
>  ><br>
>  ><br>
>  > Simon.<br>
>  ><br>
>  > On 22.01.2026 14:05, Niten Jaiswal via Dnsmasq-discuss wrote:<br>
>  >  > I’m running version 2.91_1.1 on opnsense version 25.7.10.  Below is my<br>
>  >  > configuration:<br>
>  >  ><br>
>  >  > OPNsense:~ # cat /usr/local/etc/dnsmasq.conf<br>
>  >  ><br>
>  >  > # DO NOT EDIT THIS FILE -- OPNsense auto-generated file<br>
>  >  ><br>
>  >  > #<br>
>  >  ><br>
>  >  ><br>
>  >  > rebind-localhost-ok<br>
>  >  ><br>
>  >  > stop-dns-rebind<br>
>  >  ><br>
>  >  ><br>
>  >  > port=5353<br>
>  >  ><br>
>  >  ><br>
>  >  > # If you want dnsmasq to listen for DHCP and DNS requests only on<br>
>  >  ><br>
>  >  > # specified interfaces (and the loopback) give the name of the<br>
>  >  ><br>
>  >  > # interface (eg eth0) here.<br>
>  >  ><br>
>  >  > # Repeat the line for more than one interface.<br>
>  >  ><br>
>  >  > interface=ixl1<br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  > dhcp-fqdn<br>
>  >  ><br>
>  >  > domain=375.jaiswal.net<br>
>  >  ><br>
>  >  > # This tells dnsmasq that a domain is local and it may answer queries<br>
>  >  > from /etc/hosts<br>
>  >  ><br>
>  >  > # or DHCP but should never forward queries on that domain to any<br>
>  >  > upstream servers.<br>
>  >  ><br>
>  >  > local=/375.jaiswal.net/<br>
>  >  ><br>
>  >  ><br>
>  >  > dhcp-authoritative<br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  > log-dhcp<br>
>  >  ><br>
>  >  > quiet-dhcp<br>
>  >  ><br>
>  >  > quiet-dhcp6<br>
>  >  ><br>
>  >  > quiet-ra<br>
>  >  ><br>
>  >  > quiet-tftp<br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  > # host entries flushed via dnsmasq_watcher.py [isc] and a dump of the<br>
>  >  > static reservations<br>
>  >  ><br>
>  >  > addn-hosts=/var/etc/dnsmasq-hosts<br>
>  >  ><br>
>  >  > addn-hosts=/var/etc/dnsmasq-leases<br>
>  >  ><br>
>  >  ><br>
>  >  > dns-forward-max=15000<br>
>  >  ><br>
>  >  > cache-size=10000<br>
>  >  ><br>
>  >  > local-ttl=1<br>
>  >  ><br>
>  >  ><br>
>  >  > conf-dir=/usr/local/etc/dnsmasq.conf.d,*.conf<br>
>  >  ><br>
>  >  ><br>
>  >  > dhcp-range=tag:ixl1,X.X.X.30,X.X.X.199,86400<br>
>  >  ><br>
>  >  ><br>
>  >  > domain=375.jaiswal.net,X.X.X.30,X.X.X.199<br>
>  >  ><br>
>  >  > dhcp-range=tag:ixl1,::1000,::2000,constructor:ixl1,64,86400<br>
>  >  ><br>
>  >  ><br>
>  >  > domain=X.X.X,::1000,::2000<br>
>  >  ><br>
>  >  ><br>
>  >  > dhcp-host=d8:0d:17:41:af:2c,X.X.X.23,TL-SG108PE<br>
>  >  ><br>
>  >  > dhcp-host=68:1d:ef:18:b2:c6,X.X.X.29,camect-home-2fefa<br>
>  >  ><br>
>  >  > dhcp-host=dc:f5:05:18:4e:fb,X.X.X.34,mwmdemo-4EFB<br>
>  >  ><br>
>  >  > dhcp-host=1c:1d:d3:d8:23:e6,X.X.X.35,Nitens-Mac-Studio<br>
>  >  ><br>
>  >  > dhcp-host=a8:51:ab:02:3f:28,X.X.X.99,Guest_Room_AppleTV<br>
>  >  ><br>
>  >  > dhcp-host=00:1a:ae:00:40:4b,X.X.X.101<br>
>  >  ><br>
>  >  > dhcp-host=00:1a:ae:02:5f:16,X.X.X.113<br>
>  >  ><br>
>  >  > dhcp-host=88:c9:e8:bc:e9:50,X.X.X.116,Sony_A95K_FM<br>
>  >  ><br>
>  >  > dhcp-host=60:81:f9:ac:66:58,X.X.X.128,Helium-Hotspot<br>
>  >  ><br>
>  >  > dhcp-host=00:0c:d0:01:23:33,X.X.X.132<br>
>  >  ><br>
>  >  > dhcp-host=b8:2c:a0:5b:5d:14,X.X.X.142,android-a3369b84877d627a<br>
>  >  ><br>
>  >  > dhcp-host=80:a5:89:aa:42:67,X.X.X.152,mwmdemo-4267<br>
>  >  ><br>
>  >  > dhcp-host=90:56:82:98:56:c2,X.X.X.201,AmanBluesound<br>
>  >  ><br>
>  >  > dhcp-host=18:bb:26:e2:2f:43,X.X.X.202,RianBluesound<br>
>  >  ><br>
>  >  > dhcp-host=90:56:82:40:91:49,X.X.X.203,MasterBedroom<br>
>  >  ><br>
>  >  > dhcp-host=64:95:6c:0a:94:76,X.X.X.204,LG_Projector_MB<br>
>  >  ><br>
>  >  > dhcp-host=38:c9:86:14:8b:ae,X.X.X.205,10ddb198e7550000<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:4e:b5:d6,X.X.X.206,RianBedroomFan<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:4e:ac:37,X.X.X.207,AmanBedroomFan<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:35:e4:5c,X.X.X.208,MasterBedroomFa<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:4e:ce:5a,X.X.X.209,FamilyRoomFan<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:e4:44:ce,X.X.X.210,OfficeFan<br>
>  >  ><br>
>  >  > dhcp-host=00:11:d9:56:96:45,X.X.X.211,TIVO-A9200019027F13F<br>
>  >  ><br>
>  >  > dhcp-host=20:f8:5e:4e:ad:57,X.X.X.212,PlayRoomFan<br>
>  >  ><br>
>  >  > dhcp-host=00:1b:7c:09:81:9f,X.X.X.213,sdr35-589374<br>
>  >  ><br>
>  >  > dhcp-host=00:11:d9:8f:15:09,X.X.X.214,TIVO-849601190366E67<br>
>  >  ><br>
>  >  > dhcp-host=14:91:82:d8:4b:70,X.X.X.221,Wemo_soffit<br>
>  >  ><br>
>  >  > dhcp-host=00:1b:7c:09:81:b1,X.X.X.222,sdp55-58b1f0<br>
>  >  ><br>
>  >  > dhcp-host=d4:6a:91:0e:88:d2,X.X.X.223,Wattbox<br>
>  >  ><br>
>  >  > dhcp-host=ec:a9:07:10:7a:50,X.X.X.224,AppleTVvingRoom<br>
>  >  ><br>
>  >  > dhcp-host=4c:ab:4f:90:c6:47,X.X.X.225,AppleTVmilyRoom<br>
>  >  ><br>
>  >  > dhcp-host=c8:d0:83:ca:46:cc,X.X.X.226,MasterBAppleTV3<br>
>  >  ><br>
>  >  > dhcp-host=00:11:d9:96:e8:9a,X.X.X.227,TIVO-84900119048F1A6<br>
>  >  ><br>
>  >  > dhcp-host=id:00:01:00:01:2d:af:54:ce:b8:e6:0c:13:e7:1e,<br>
>  >  > [::b9cc],m1_macbook_pro<br>
>  >  ><br>
>  >  > dhcp-host=id:00:04:bb:36:4d:56:f5:2c:9f:11:50:7a:32:82:60:23:dd:e1,<br>
>  >  > [::bbc1],pi-hole<br>
>  >  ><br>
>  >  > dhcp-host=id:00:01:00:01:29:42:4e:a4:14:98:77:7b:27:6d,[::bbc2],mac-<br>
>  >  > mini-server<br>
>  >  ><br>
>  >  > dhcp-host=id:00:01:00:01:2e:ea:7c:b5:00:1a:1e:04:13:98,<br>
>  > [::bbc3],aruba-master<br>
>  >  ><br>
>  >  > dhcp-host=id:00:01:00:01:2e:ea:7c:b5:00:1a:1e:04:13:98,[::bbc3],aruba-<br>
>  >  > conductor<br>
>  >  ><br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,60,ArubaAP<br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,43,X.X.X.2<br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,66,X.X.X.10<br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,150,X.X.X.10<br>
>  >  ><br>
>  >  > dhcp-option=42,X.X.X.1<br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,6,X.X.X.4<br>
>  >  ><br>
>  >  > dhcp-option=tag:ixl1,option6:23,[::bbc1]<br>
>  >  ><br>
>  >  ><br>
>  >  > # default dns mapped to this server (0.0.0.0)<br>
>  >  ><br>
>  >  > dhcp-option=6,0.0.0.0<br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  > no-ident<br>
>  >  ><br>
>  >  ><br>
>  >  ><br>
>  >  > *From: *Dnsmasq-discuss <dnsmasq-discuss-<br>
>  >  > bounces@lists.thekelleys.org.uk> on behalf of Niten Jaiswal via<br>
> Dnsmasq-<br>
>  >  > discuss <dnsmasq-discuss@lists.thekelleys.org.uk><br>
>  >  > *Date: *Tuesday, January 20, 2026 at 9:53 PM<br>
>  >  > *To: *dnsmasq-discuss@lists.thekelleys.org.uk <dnsmasq-<br>
>  >  > discuss@lists.thekelleys.org.uk><br>
>  >  > *Subject: *[Dnsmasq-discuss] Potential memory leak<br>
>  >  ><br>
>  >  > Hi!<br>
>  >  > I’m a user of opnsense and have migrated to dnsmasq for DHCPv4 and v6<br>
>  >  > services.  However, dnsmasq randomly stops functioning and I need to<br>
>  >  > manually restart it to restore DHCP services to my network.  I’ve been<br>
>  >  > troubleshooting the issue on the opnsense form on the following<br>
> thread:<br>
>  >  > <a href="https://forum.opnsense.org/index.php?topic=49552.30" data-outlook-id="56700cd0-3324-4cff-9308-48fa9c52f57e">
https://forum.opnsense.org/index.php?topic=49552.30</a> <https://<br>
> forum.opnsense.org/index.php?topic=49552.30> <https://<br>
>  > forum.opnsense.org/index.php?topic=49552.30> <https://<br>
>  >  > forum.opnsense.org/index.php?topic=49552.30><br>
>  >  ><br>
>  >  > My basic testing points to an issue with serving DHCPv6 addresses.<br>
>   When<br>
>  >  > I have router advertisement set to unmanaged the memory consumption of<br>
>  >  > dnsmasq was fairly stable.  When router advertisement is set to<br>
> managed<br>
>  >  > then dnsmasq begins consuming more and more memory..<br>
>  >  ><br>
>  >  > Let me know if you need additional information.  I was asked to<br>
> post to<br>
>  >  > the email list by an opnsense forum moderator.<br>
>  >  ><br>
>  >  > TIA<br>
>  >  > Niten<br>
>  >  ><br>
>  >  > _______________________________________________<br>
>  >  > Dnsmasq-discuss mailing list<br>
>  >  > Dnsmasq-discuss@lists.thekelleys.org.uk<br>
>  >  > <a href="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-" data-outlook-id="c89fa41a-de5b-4f49-825f-93e16da40931">
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-</a><br>
> <<a href="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-" data-outlook-id="2771e3d4-dff6-4f4e-8149-3a35dfc5a102">https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-</a>><br>
>  > discuss <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/<br>
>  > dnsmasq-discuss><br>
>  ><br>
>  ><br>
>  > _______________________________________________<br>
>  > Dnsmasq-discuss mailing list<br>
>  > Dnsmasq-discuss@lists.thekelleys.org.uk<br>
>  > <a href="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-" data-outlook-id="7d798a83-83c4-44b0-a8bf-9dc276c56cae">
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-</a><br>
> discuss <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/<br>
> dnsmasq-discuss><br>
>  > <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-<br>
> discuss <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/<br>
> dnsmasq-discuss>><br>
><br>
<br>
</div>
</div>
</div>
</body>
</html>