简体   繁体   中英

Out of memory Exception . c#

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream respStream = response.GetResponseStream();
using (var sr = new StreamReader(respStream, Encoding.UTF8))
using (JsonReader reader = new JsonTextReader(sr))
 {
    JsonSerializer serializer = new JsonSerializer();
    ServiceModel toReturn = serializer.Deserialize<ServiceModel>(reader);
    String resps = JsonConvert.SerializeObject(toReturn, Formatting.Indented);
  }

Getting OutOfMemory exception on after this line :

String resps = JsonConvert.SerializeObject(toReturn, Formatting.Indented); .

How to Handle this in C#(Compact Framework).

似乎有一些循环引用...使用http://www.ndepend.com/Features/#DependencyCycle进行检查

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM