Not answering your primary question, but I think Adguard supports DoT natively, so there's no need to run stubby with it. (I run stubby because I'm using a dnsmaq-based ad blocker, adblock.)
As @efahl said, if you're running AdGuard Home, you don't need stubby for TLS.
I run OpenWRT and AdGuard Home on a 256MB consumer router (Linksys EA7500). I do not use many other software packages, but I have a fairly complex network, I still have dnsmasq providing local DHCP and DNS, and I host a wireguard VPN for remote access. Here's the output of "free":
total used free shared buff/cache available
Mem: 250352 98656 97660 17096 54036 91556
Swap: 0 0 0
So depending on your individual situation, I'm guessing 128MB would work, but it's a little tight and won't leave room for much else.
Edit: Note that is while limiting AdGuard Home's in-memory log rotation to 18 hours and statistics retention to 24 hours. I've got room for a lot more but I don't really need more logging and statistics than that so I might as well save the memory for caching and other purposes. Note also that the number and size of DNS blocklists you use in AdGuard Home will affect memory consumption.
Thanks for the reply, i am looking for hardware with 256mb of flash, but the ones i found they are very expensive, or have small flash with adicional memory in other chip not of flash. Like banana pi R3 ou R4.
Any other options or sugestions?