SQL Server没有释放内存 [英] SQL Server isn’t releasing memory

查看:98
本文介绍了SQL Server没有释放内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个用MFC编写的应用程序,该应用程序以固定的间隔从数据库中获取一些记录集.我的问题是,一旦该应用程序启动,它将导致sql内存增加,并且不会释放它.

我已经检查了我的mfc应用程序是否存在内存泄漏,但是它没有任何内存泄漏.
我用谷歌搜索,发现了一些解决该问题的方法,但这对我没有帮助.我想要的是什至我要关闭我的应用程序sql server时也应该释放内存.

请帮助我!

Hi Everyone,

I have one application written in MFC which fetches a some record set''s from database with regular intervals, My problem is that onces the application is get started it couses the increase in sql memory and it does not release it.

I have check my mfc application for memory leaks but it dont have any memory leaks.
I google it, and i found some solution for this problem but that is not helpfull for me. what i want that When even i will close my application sql server should release the memory.

Please help me!

推荐答案

实际上,一旦SQL Server抢占了内存,它就不会释放内存.我写了一个小脚本来释放内存.但是,您不应在繁忙的服务器上运行它.

512号可以更改为较小的数字,但是请注意,因为数字太低可能会使服务器崩溃.



USE管理员

EXEC sp_configure``显示高级选项'',1
重新配置以覆盖

EXEC sp_configure``最大服务器内存(MB)''

EXEC sp_configure``最大服务器内存(MB)'',512
重新配置以覆盖

EXEC sp_configure``最大服务器内存(MB)''

WAITFOR DELAY''00:00:15'';

EXEC sp_configure``最大服务器内存(MB)'',2147483647
重新配置以覆盖

EXEC sp_configure``最大服务器内存(MB)''

EXEC sp_configure``显示高级选项'',0
重新配置以覆盖


-Thomas Ross,pikitfense,当时是点点com
Actually SQL server does not release memory when once it grabs ahold of it. I have written a little script that I use to release memory. However you should NOT run this on a busy server.

the 512 number can be changed to a lower number but be careful as you might crash your server with too low of a number.



USE master

EXEC sp_configure ''show advanced options'', 1
RECONFIGURE WITH OVERRIDE

EXEC sp_configure ''max server memory (MB)''

EXEC sp_configure ''max server memory (MB)'', 512
RECONFIGURE WITH OVERRIDE

EXEC sp_configure ''max server memory (MB)''

WAITFOR DELAY ''00:00:15'';

EXEC sp_configure ''max server memory (MB)'', 2147483647
RECONFIGURE WITH OVERRIDE

EXEC sp_configure ''max server memory (MB)''

EXEC sp_configure ''show advanced options'', 0
RECONFIGURE WITH OVERRIDE
go

-Thomas Ross, pikitfense at h o t m a i l dot com


我不了解MFC.但是,您可以检查是否正确关闭/布置了连接对象吗?另外,您是否考虑过考虑ConnectionPooling?
I don''t know MFC. But, can you check if you are properly closing/disposing the connection objects? Also, have you thought of considering ConnectionPooling?


它还取决于您用来连接SQL Server的驱动程序.
请使用SQL Server OLE db驱动程序和连接器.
由于分配和释放内存对象非常灵活.

它还取决于您使用了哪种方法从SQL Server中提取数据.

我怀疑您应该使用存储过程并从您的代码中调用该SP.

请避免循环遍历记录集.
如果您设置一个射击活动,那就太好了.
Its also depend upon what driver you have used to connect the SQL server.
Please use SQL server OLE db driver and connector .
Since it is very flexible to allocate and releas memory objects.

It also depends upon what method you have used to pull out data from SQL server.

I suspect you should use Stored procedure and call that SP from within your code.

Please avoid looping thoruhg the record set .
It would be very nice if you set up one shot activity.


这篇关于SQL Server没有释放内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆