Why is my Wi-Fi process using 3GB of memory?
First thing first - memory is virtual, so Wi-Fi could take 100 GB and you might only have a low grade leak that seems bad, but in practice has no effect whatsoever over a two week period or longer.

Here how I’d evaluate this measurement in context :


What is the overall memory pressure graph like on the machine?
How long after you started did it take to get to that status?


Now that you have some data points and can agree that the numbers mean less without context, here’s how to reclaim that memory.

Once you get the data above, log out (Apple Menu - log out Michael, then log back in). The ports and memory should start very small.

I haven’t seen this cause issues across our production fleet and there is speculation that IPv6 networking or iPhone tethering can cause this higher than expected, but not impacting performance level of allocations. Also, people that tend to have dozens or a score of tabs open in multiple browsers would likely have a lot of memory to track that. Lastly, not logging out regularly would allow this to grow if it’s a leak / usage situation.


Wi-Fi taking up lot of memory


As to the ultimate question of why, you have nailed the ports being the reason for this process. In the Mach kernel architecture, ports are how processes communicate, so every program that needs any network access or to send a communication to another process, needs ports to queue and deliver and secure those network data chunks. 


https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html


The Wi-Fi program is doing its sole function which is to connect your programs in your user space to the system/kernel that then runs the network drivers and does the communication with the hardware layer. 

I see nothing shocking here, but here's the low down on using vmmap and heap to pick apart why yours is using less memory when you log in (and almost none if you start no apps at log in) and then when you run your programs that assign work to Wi-Fi - it allocates memory to do that work you asked of the wireless networking system.


Why is my Wi-Fi Process eating &gt;2GB memory