日期:2014-05-19  浏览次数:20778 次

急,在线等!调用ajax,返回json,报异常java.lang.OutOfMemoryError: Java heap space
调用ajax,返回json,
报异常
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:502)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:318)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:161)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:323)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:161)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.array(JSONWriter.java:409)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:151)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:323)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:161)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:323)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:161)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.array(JSONWriter.java:409)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:151)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:323)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:161)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:127)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:323)

jsp中调用ajax部分:
$.ajax({  
type: "POST",  
//dataType: "text", 
async: false,//ajax同步  
url: "<%=request.getContextPath() %>/violationinfo/findStreetsNewWin.action", //提交到一般处理程序请求数据  
data: "pageNum=" + pageIndex + "&pageSize=" + pageSize + "&streetNameNewWin=" + streetNameNewWin,  
success: function(json) { 
json = eval("(" + json + ")"); 
var data = json.data; 
totalRecords = json.pager.totalRecord;
if(data != "" && totalRecords != 0) {  
$("#table2 tr:gt(0)").remove(); //移除Id为Result的表格里的行,从第二行开始(这里根据页面布局不同页变)  
$("#table2").append(data); //将返回的数据追加到表格  
}else {
$("#table2 tr:gt(0)").remove(); //移除Id为Result的表格里的行,从第二行开始(这里根据页面布局不同页变)  
}
}  
});  
请问是什么原因啊?该如何解决呢?非常感谢

------解决方案--------------------
for(i