On Mon, 14 Apr 2025, Nitesh Divecha via Dnsmasq-discuss wrote:
I've observed that dnsmasq memory usage steadily increases over time,
It's possible that the libc in use is memory-mapping the log file. [...] In this case some measures of the process's memory usage would increase, but the actual physical RAM usage would not - long untouched pages will be written out to the filesystem and the RAM freed for reuse, just like swapping.
# systemctl status dnsmasq [...] Memory: 16.3M
This is a very coarse view of memory usage and doesn't tell you much about what's actually going on. For a much more detailed view of how the dnsmasq process uses memory, look in /proc/$(pidof dnsmasq)/smaps or in the smaps_rollup file for a summary, or you can run `pmap -X $(pidof dnsmasq)` for a slightly more compact, columnar view.
If you monitor the contents of this file or the pmap output over time, you should be able to see where the memory is being used.
https://docs.kernel.org/filesystems/proc.html has information about what the different fields mean. Memory management gets a little hairy, but the most important parts (IMO and as I understand it) is "RSS", which shows how much of that mapping is using up actual, physical RAM; "Shared", which shows how much memory is shared with at least one other process (thus only taking up memory once even though it's mapped into multiple processes) vs "Private", which is unique to this process; and "Clean" which has not been modified compared to the underlying storage and could thus be evicted from memory if space is needed vs "Dirty", which must first be written to storage before it can be reclaimed.
-- Peter Tirsek _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss