内存将增加每个循环周期。任何想法为什么是这样?htmlunit内存泄漏
public static void main(String p[]) throws IOException {
WebClient webClient = new WebClient();
for (int a = 0; a < 100000; a++) {
HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
String pageAsXml = page.asXml();
System.out.println(pageAsXml);
}
}
由于提前
看看@Daarin的答案!此方法现在已被弃用,应该在版本2.16及更高版本中更改为webClient.close() – Kerooker 2018-01-21 05:11:38