Open ndfred opened 5 years ago
This is actually the configuration process running out of memory, not the system or dnsmasq. I'll have to figure out a way around this anyway (see #12) so this may not be an issue after all.
Without any filters applied we get 0.4% of system memory (4th argument), 6M virtual size (5th) and 2M resident set size (6th):
$ ps aux | grep dnsmasq.d
dnsmasq 2433 0.0 0.4 6000 2056 ? S 16:14 0:02 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
Digging into /proc/2433/smaps
I can see 132k + 128k of heap size and 132k of stack size. Querying /proc/meminfo
the system has 512M of memory and only 44% of memory is being used.
After following the vanilla ad blocking set script we see 0.9% of system memory, 5.6M of self memory usage so 3.5M of additional memory usage:
$ ps aux | grep dnsmasq.d
dnsmasq 11559 0.9 1.1 9588 5596 ? S 17:48 0:00 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
The blacklist in /etc/dnsmasq.d/blacklist.conf
is 672k so that is quite the memory hike, though not significant system-wide. I'll test with larger blacklists to see how big a difference that makes.
The original file was 672k, I just tried with the new 1.9M file from v0.2.32 we see 2.6% of system memory, 11.7M of self memory usage so 9.7M of additional memory usage:
$ ps aux | grep dnsmasq.d
dnsmasq 11773 2.6 2.3 15652 11684 ? S 23:54 0:02 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
This is starting to get really significant. We see 48% of system memory used, up 4%.
When trying to run the configuration commands the system runs out of memory:
It looks like a lot of hosts entries get dropped, maybe bad formatting or duplicates with the domains, worth filtering out when we produce the files.