我的基于LLBLGen的大型32位web服务数据访问应用程序在一台专用的64位计算机上单独运行。当进程释放几乎所有分配的空间(最多1,5 2GB )时,它的物理内存消耗稳定地增长到大约2 2GB,并从这一点开始继续增长。页面输入值或其他页面文件使用参数没有明显增加,因此看起来内存被释放了,而不是换出到页面文件。我在想这是一种什么样的个人资料?实际上,没有什么可以阻止进程抓取它能抓取的所有内存,另一方面,在内存释放周围有不可接受的http内部错误-可能是清理块有用的工作。考虑到上述行为是一种可接受的行为,什么才是使清理工作不那么引人注目的好策略。
发布于 2008-11-10 16:25:55
我们遇到了类似的情况,并更改了所有数据库连接,以使用try/catch/finally方法。Try用于执行代码,捕获错误收集,最后关闭所有变量和数据库连接。
internal BECollection<ReportEntity> GetSomeReport()
{
Database db = DatabaseFactory.CreateDatabase();
BECollection<ReportEntity> _ind = new BECollection<ReportEntity>();
System.Data.Common.DbCommand dbc = db.GetStoredProcCommand("storedprocedure");
try
{
SqlDataReader reader = (SqlDataReader)db.ExecuteReader(dbc);
while (reader.Read())
{
//populate entity
}
}
catch (Exception ex)
{
Logging.LogMe(ex.Message.ToString(), "Error on SomeLayer/SomeReport", 1, 1);
return null;
}
finally
{
dbc.Connection.Close();
_ind = null;
}
return _ind;
}https://stackoverflow.com/questions/277925
复制相似问题