Forum Discussion
SQL Server 2019 Express memory leak after databases list query
Hi DanielE80,
Firstly, I suggest reviewing the SQL Server error log. You can locate the path using the TSQL command:
EXEC xp_readerrorlog 0, 1, N'Logging SQL Server messages in file', NULL
SQL Server typically gathers DBCC MEMORYSTATUS results in cases of Out of Memory (OOM) errors. This would be a good starting point for your investigation.
Secondly, I recommend collecting performance monitor data. You can use the script provided below. Remember to open the command prompt as an administrator.
To create the performance log, use the following command:
logman.exe create counter SQLServerPerf_mp -f bincirc -v mmddhhmm -max 1000 -c "\Processor(*)\*" "\LogicalDisk(*)\*" "\TCP\*" "\Memory\*" "\Network Interface(*)\*" "\PhysicalDisk(*)\*" "\Process(*)\*" "\Paging File\*" "\SqlServer:Wait Statistics(*)\*" "\SqlServer:SQL Statistics\*" "\SqlServer:Resource Pool Stats(*)\*" "\SqlServer:Memory Manager\*" "\SqlServer:Memory Node(*)\*" "\SqlServer:General Statistics\*" "\SqlServer:Databases(*)\*" "\SqlServer:Buffer Manager\*" "\SqlServer:Access Methods\*" "\SqlServer:Transactions\*" "\SqlServer:SQL Errors\*" "\ProcessorPerformance\*" "\SqlServer:Database Replica\*" "\SqlServer:Locks\*" -si 00:00:10
To start the performance log:
logman.exe start SQLServerPerf
Wait for the issue to reoccur. Once it does, execute the following command to stop the performance log:
logman.exe stop SQLServerPerf
The default location for the logs is C:\perflogs.
Lastly, it's important to verify that there are no third-party modules loaded in memory that could potentially be the root cause of a memory leak. You can do this by executing the following SQL query:
SELECT * FROM sys.dm_os_loaded_modules WHERE company <> 'Microsoft Corporation'
Please feel free to share data for analysis.