0
This is an SQL Server 2016 CU2 instance with 15 GB configured as maximum RAM usage. MDOP is at 4. The databases in this instance are very sporadically queried by users and this is a read-only secondary replica.
The problem: on a weekly basis all queries enter into RESOURCE_SEMAPHORE state due to memory exhaustion, even when no other queries are running simultaneously in this server. After an instance restart, the queries start working again. By the images below, you'll notice that we are lacking Maximum Workspace Memory and these are really REALLY bad queries (astronomical query costs).
Before restart: only 1,8 GB of available Maximum Workspace Memory and ALL bad queries entering into a RESOURCE_SEMAPHORE state.
After instance restart: plenty of Workspace Memory (~11GB) and no RESOURCE_SEMAPHORE anymore, even for awful queries.
As you can see, it's a repulsive query that is asking for ~2GB of RAM. In this image, SSMS shows that the required memory was actually granted - because the instance was restarted. Before the restart, memory grant remains at NULL and the query stays at the RESOURCE_SEMAPHORE wait state.
Now, what we would like to know is: why is Maximum Workspace Memory decreasing over time and not being freed when there are no queries running?