获取一个OutOfMemoryException同时连载到JSON? [英] Getting an OutOfMemoryException while serialising to JSON?

查看:357
本文介绍了获取一个OutOfMemoryException同时连载到JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我序列化时, MultiDictionary<弦乐,对象>

http://powercollections.codeplex.com/到JSON。

它拥有618元与元素被深度嵌套,即一个对象可能有几个字典就像它的对象。我使用JSON.Net

It has 618 elements with elements being deeply nested ,i.e. a single Object may have several dictionary like objects in it . I am using JSON.Net

String json = JsonConvert.SerializeObject(json, Newtonsoft.Json.Formatting.Indented);



我在想什么?

what am i missing ?

更​​多信息: -
这是工作的罚款,直到我用动态的,我不得不切换到MultiDictionary允许同一名称的多个属性。它适用于大多数情况下,只有当项目数是大的,它打破。

MORE INFO: - This was working fine till i was using dynamic , i had to switch to MultiDictionary to allow multiple properties of the same name . It works for most cases , only when the number of items is large , it breaks .

更​​新: -

我已经能够得到内存消耗的保持,但削​​减一些这都拿到递归添加到每个元素的元素。

I have been able to get a hold of the Memory consumption but cutting down on some elements that were getting added recursively to each element.

推荐答案

看样子,你正在运行到的 Ciruclar参考是导致 OutOfMemoryException异常或你的对象只是为你的内存过大。使用 NDepend的进行检查。

It appears that you're running into Ciruclar Reference that is causing OutOfMemoryException or your objects are simply too large for your memory. Use NDepend to check this.

您可能会发现有用让你的对象的总大小

这篇关于获取一个OutOfMemoryException同时连载到JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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