473,549 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6720
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********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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

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

Similar topics

17
4778
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 easier to reproduce (e.g.: remote machine not available). After about 1 day, I get a usage of 300MB of memory. I have used .NET Memory Profiler tool to...
7
1578
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 is accessed because the data that's being stored is time relevant and the web app will be thrown out in a few months. Since I try to separate the...
16
2375
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. Example: After about 5 hours with a concurrent user base of about 150 users the application raises the aspnet_wp memory usage by almost 500MB. If...
9
425
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 which application and which dll and asmx page that cause the problem. {Rheena} May I know what operating system you are using?
23
4520
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
2304
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 ASP page written in JScript that connects to Analysis Services 2000 using ADOMD and retrieves data from it (this is a very simplified version of our...
7
6921
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 the status of the machines. Upon we follow the .NET object lifetime recommendations the application is constantly consuming more memory! The problem...
8
2040
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 omit this? I'm dealing with a large number of files with nested includes. There
7
15675
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 lot of memory but I still had to use it. 1. After using DLLImport and seeing the memory leak I tried to load and
2
2690
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. I looked at the memory and it seems to be full. I removed all the javascript code - and the app seems to be have no leaks. As soon as I include my...
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.