473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Memory leak in SQL Server

I have a stand alone Java application that uses MS SQL Server 2000 and
Microsoft JDBC ODBC drivers to access it. Before I run the application,
I open the task Manager to monitor the memory used by the SQL Server.
Generally it begins 21 MB and very soon it reaches around 100 MB if I
do some operations in the application. The thing is that even if I
close the application, the memory taken by SQL Server doesn't go down.
What could be the reason behind it? Java code or MD drivers or SQL
Server?
I checked the code and we are closing the statements and result set and
commiting everywhere.

Please let me know...I am trying to refactor as much as I can but still
out of luck.

Jul 23 '05 #1
12 6707
It is not a memory leak. It is most likely due to the buffer pool growth.
When the server is started, buffer pool reserves a lot of memory but not
committed. The buffer page memory is committed only one-by-one upon demand
when the app issues queries to read/write data. TaskMgr only shows the
committed memory, which is why you saw the memory used by sqlservr
increased. And once the buffer page memory is committed, normally buffer
pool doesn't give them back unless under memory pressure. This is why after
the app ends, the memory used by sqlservr in TaskMgr doesn't go down.

Other usage of memory in the server can also contribute here: for example,
the query plans used by the app can be cached by the procedure cache for
furure usage, etc.

--
Gang He
Software Design Engineer
Microsoft SQL Server Storage Engine

This posting is provided "AS IS" with no warranties, and confers no rights.
"Bardolator" <Ba********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a stand alone Java application that uses MS SQL Server 2000 and
Microsoft JDBC ODBC drivers to access it. Before I run the application,
I open the task Manager to monitor the memory used by the SQL Server.
Generally it begins 21 MB and very soon it reaches around 100 MB if I
do some operations in the application. The thing is that even if I
close the application, the memory taken by SQL Server doesn't go down.
What could be the reason behind it? Java code or MD drivers or SQL
Server?
I checked the code and we are closing the statements and result set and
commiting everywhere.

Please let me know...I am trying to refactor as much as I can but still
out of luck.

Jul 23 '05 #2
If that is the thing then is there a way to keep the memory of SQL
server down? Any settings in the SQL server or any code to clear the
buffer? The reason is that if the machine or SQL server isn't started
for few days on a machine, SQL server tends to take more than 200 MB of
memory which slows down the computer.
(Wonder why no one else complains of this memory issue on the net)

Jul 23 '05 #3
The amount of memory used by sql 2000 is definable. Enterprise
mgr>right mouse properties on server in question>memory tab.

No one complains because it is not a problem. Caching selected
data/procedure plans/etc... is a good thing in databases.

-scott

Jul 23 '05 #4

"Bardolator" <Ba********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
If that is the thing then is there a way to keep the memory of SQL
server down? Any settings in the SQL server or any code to clear the
buffer? The reason is that if the machine or SQL server isn't started
for few days on a machine, SQL server tends to take more than 200 MB of
memory which slows down the computer.
(Wonder why no one else complains of this memory issue on the net)
Because you want to give a DB server as much memory as possible.

My guess is that you're not running on a dedicated machine?

Add memory if at all possible.


Jul 23 '05 #5
Bardolator wrote:
If that is the thing then is there a way to keep the memory of SQL
server down? Any settings in the SQL server or any code to clear the
buffer? The reason is that if the machine or SQL server isn't started
for few days on a machine, SQL server tends to take more than 200 MB
of memory which slows down the computer.
(Wonder why no one else complains of this memory issue on the net)


Even if it takes 200MB this is not a problem as long as the DB is not
used. The OS will evetually page out unused mem to disk. You might want
to increase virtual memory.

Alternatively you can decrease memory settings for SQL Server but this
impacts the DB's performance.

OTOH, 200MB isn't really much for a DB. Buying some additional mem is not
a bad idea.

Kind regards

robert

Jul 23 '05 #6
This is a stand alone java application using the stand alone sql server
(actually MSDE for the end users) that is resident on their PCs. So 200
MB is a lot if only one user is connected to it. I will try to change
the settings and will see what happens.

Jul 23 '05 #7
Bardolator wrote:
This is a stand alone java application using the stand alone sql
server (actually MSDE for the end users) that is resident on their
PCs. So 200 MB is a lot if only one user is connected to it. I will
try to change the settings and will see what happens.


It does seem much to you - it doesn't to me. :-)

Note also that the memory usage is mainly determined by the amount of data
you touch and not by the sheer number of users.

Kind regards

robert

Jul 23 '05 #8
But I thought that the whole point of having a scale down version of
SQL Server (which is MSDE) is that it can be installed on individual
PCs. Also, MSDE 1.0 (which is the scale down version of SQL Server 7.0)
did not take this much of memory.

Jul 23 '05 #9
Is there actually a real problem with the performance of your
application or are you just curious about the memory usage of SQL
Server?

It is always better to make questions clearer as they elicit more
specific responses.

i.e. the subject of the internal workings of SQL Server and Windows
virtual memory allocation could take a great many posts to explain and
you would probably be better off reading books such as Inside SQL
Server or The Gurus Guide To SQL Server Architecture and Internals.

Jul 23 '05 #10
Its both curiosity and a bug. A machine with 512 MB (this is all we can
ask our customer) that has MSDE and it's database is just 26 MB takes
around 200 MB of RAM. This seems to be a problem. SQL 7.0 doesn't use
to do this.

Jul 23 '05 #11
You haven't answered my question you have simply restated the memory
usage observation. Is this actually a performance problem?

Is your application noticably slower with the 2K version of MSDE?

Are other applications running on the same machine crawling to a halt?

SQL Server will rightly take as much memory as it can but should be a
good citizen when it comes to playing nicely with other apps demands.

Malc
www.dbghost.com - Build, Compare and Synchronize = Database Change
Management for SQL Server

Jul 23 '05 #12
Bardolator (Ba********@gmail.com) writes:
Its both curiosity and a bug. A machine with 512 MB (this is all we can
ask our customer) that has MSDE and it's database is just 26 MB takes
around 200 MB of RAM. This seems to be a problem. SQL 7.0 doesn't use
to do this.


Just because you don't like, does not mean that it is a bug.

Use sp_configure to constrain how much memory SQL Server may use.

exec sp_configure 'max server memory', 100
go
reconfigure

100 is 100 megabyte.

You have have to first say:

exec sp_configure 'show advanced', 1
go
reconfigure
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
7
by: Jon Davis | last post by:
OK I have a web app that I built that makes MANY calls to the DB in each request. The app wasn't tuned for scalability so this wasn't a problem, but time is too short to redesign how the database...
16
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. ...
9
by: Anton | last post by:
{Willy Skjveland} Hi, how can I trace a Memory leak in aspnet_wp.exe? {Rheena} One moment please while I search it for you. It may take me a few moments {Willy Skjveland} I need to find out...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
1
by: Charlotte | last post by:
Hello, We are doing a stability test on our application to prepare for Microsoft SQL Server 2000 certification, and we found a memory leak, but we cannot find its source and fix it. We use an...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
8
by: Lauren the Ravishing | last post by:
Hi, In ASP, is it absolutely necessary to set an object to Nothing after being used? set myObj = server.createObject("myDLL.myClass") call myObj.useClass set myObj = Nothing <--- can I...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
2
by: Jay | last post by:
I have a web app running on the windows CE device. In one of the asp.net pages - it has javascript code. That seems to have a memory leak. When I run the web app - in about one hour, the app hangs....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.