数据查询出现 System.OutOfMemoryException”的异常

Joson.e8love 2010-11-25 10:41:07
再执行程序时 发现出现内存溢出 查了半天觉得的是数据库问题 就直接打开数据库 结果一直显示 数据检索中

或者好久只出来一条数据 有时间干脆什么都没有

用 查询语句 出现下面问题

在执行批处理时出现错误。错误消息为: 引发类型为“System.OutOfMemoryException”的异常

朋友给说 先用 selec count(*)下 结果却是可以了 但 当我再次打开表时间 还是出现同样问题

百度搜索说 大多是 字段为日期型 结果给空了 但我没有这样的字段类型

里边字段类型 有ntext 存放着 JSON 数据 会不会是这个问题 其他的我想应该不会出问题

在线等 谢谢了
...全文
2246 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Joson.e8love 2010-11-25
  • 打赏
  • 举报
回复
回复楼上 郁闷 我找到原因了 是我JSON 数据问题 里边删除了一条数据就可以了 谢谢了

那数据空值太多 很好引号 造成的 应该
claro 2010-11-25
  • 打赏
  • 举报
回复
贴一下结果。
claro 2010-11-25
  • 打赏
  • 举报
回复
SELECT count(*)AS cached_pages_count 
,name ,index_id
FROM sys.dm_os_buffer_descriptors AS bd
INNER JOIN
(
SELECT object_name(object_id) AS name
,index_id ,allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.hobt_id
AND (au.type = 1 OR au.type = 3)
UNION ALL
SELECT object_name(object_id) AS name
,index_id, allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.partition_id
AND au.type = 2
) AS obj
ON bd.allocation_unit_id = obj.allocation_unit_id
WHERE database_id = db_id()
GROUP BY name, index_id
ORDER BY cached_pages_count DESC;
Joson.e8love 2010-11-25
  • 打赏
  • 举报
回复
以下是SQL 弹出对话框的 详细内容:


有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.OutOfMemoryException: 引发类型为“System.OutOfMemoryException”的异常。
在 System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
在 System.Text.StringBuilder..ctor(String value, Int32 startIndex, Int32 length, Int32 capacity)
在 System.Text.StringBuilder..ctor(String value, Int32 capacity)
在 System.Windows.Forms.Control.get_WindowText()
在 System.Windows.Forms.TextBoxBase.get_WindowText()
在 System.Windows.Forms.Control.get_Text()
在 System.Windows.Forms.TextBox.get_Text()
Joson.e8love 2010-11-25
  • 打赏
  • 举报
回复
只有 10条数据 有那么耗内存? 我都想不明白 现在最能怀疑的就 那个 ntext 字符 里边放了 JSON数据

有 逗号 引号 括弧 点 什么的 会不会是他惹的祸? 如果是 该怎么解决这个问题

22,207

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧