在servlet中doPost方法中:
[code="java"]
public void doPost(HttpServletRequest request, HttpServletResponse response){
List mapList = new ArrayList();
for (int i = 0; i < 100000; i++) {
HashMap map = new HashMap();
map.put("index", String.valueOf(i));
mapList.add(map);
}
request.setAttribute("mapList",mapList);
/*
mapList=null是否有存在的必要?
个人理解方法执行完后,局部变量mapList就没有引用了,里面的map同样也没引用,系统就可以把分配给mapList的内存回收了
*/
mapList =null;
}
[/code]