SQL Server Memory usage keeps going up using SMO

Hi,

I have written an application to preview the deatils ( columns, permissions etc) of Server/database objects (Tables, Views, Logins etc) using SMO. I have just noticed that the 'Memory Usage' goes up everytime I run the application. Once it has gone up it stays up. Even when the application is shutdown the 'Memory Usage' remains the high.

What am I doing wrong

Regards,
Joginder Nahil
www.starprint2000.com



Answer this question

SQL Server Memory usage keeps going up using SMO

  • Trane Co Engineer Don

    Hi Joginder,

    What you see is not unusual. SQLServer allocates a large internal cache to improve its performance and response time.

    When SQLServer is incative, Windows will "page out" memory that is not in use. SQLServer can also yield memory to other applications.

    So, memory usage does go up but it won't grow indefinitely. Try re-running the browser app multiple times and you'll see that memory usage in the SQLServer process levels off at some point.

    Artur Laksberg
    SQL Server Team
    Microsoft



  • Tom Gillespie

    Joginder,

    What "Memory Usage" do you refer to Your application migh have a memory leak if it creates new objects and holds on to them preventing garbage collection to do its job.

    If you could post here or send me directly (arturl at microsoft dot com) a simple code snippet, I'd be happy to take a look.

    Artur Laksberg
    SQL Server Team
    Microsoft



  • JMArroyave

    Hi Artur,

    I have the similar problem. Its not stabilising , and at one point its giving me an error (insufficient memory to run this package) as i was trying to run a dts package. My mem usage is 2.7GB. When i restarted the service its going up to (minimum 1.75GB) and its increasing until 2.8 max as far as i have seen and then i get the insufficient memory error. Please let me know where iam doing wrong Or is there any way to control the high mem usage

    Thanks

    Karthik



  • arfa

    Hi Artur,

    I am talking about Mem Usage for sqlserver.exe Image Name in the Windows Task Manager. You can try it using SMOBrowser examples released with SQL Server in directory:

    \Microsoft SQL Server\90\Samples\Engine\Programmability\SMO\SmoBrowser\VB

    Here is what I found:

    Activity Mem Usage for sqlserver.exe

    Start SQL Server service 46,644K
    Start SMOBrowser & Login 46,848K

    In the Object browser treeview
    Expand SQLServer 52,692K
    Expand Databases\Northwind 53,436K
    Expand Databases\Northwind\Tables 54,672K
    Expand some Table nodes 67,264K
    Click on some random Nodes in the treeview 86,856K

    Leave the SQLServer running and quit SMOBrowser Application

    Restart SMOBrowser application and you will find that the Mem Usage for sqlserver.exe keeps on going up and it will stay up until you closedown SQLServer and restart it.

    May be I don't understand what Mem Usage column is telling me.

    Regards,

    Joginder Nahil
    www.starprint2000.com


  • SQL Server Memory usage keeps going up using SMO