我想用Wappalyzer分析大约1000个网站,以了解它们是否在使用Magento。分析的结果还可以,但是经过10-11次测试后,出现“堆满内存”错误。我该如何避免呢?
public static List<Reservation> checkDatesForReservation(Reservation reservation){
Reservation reservation = null;
List<Reservation> reservationList = new ArrayList<>();
String sql2= "SELECT ReservationStartDate, ReservationEndDate FROM treservations WHERE ReservationStartDate=? AND ReservationEndDate= ?";
try{
PreparedStatement ps = ConnectorDB.connection.prepareStatement(sql2);
ps.setString(1,reservation.getReservationStartDate());
ps.setString(2,reservation.getReservationEndDate());
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()){
reservation = new Reservation();
reservation.setReservationStartDate(rs.getString("ReservationStartDate"));
reservation.setReservationEndDate(rs.getString("ReservationEndDate"));
reservationList.add(reservation);
}
}catch (SQLException e){
e.getStackTrace();
}
return reservationList;
}
我的脚本给出了预期的结果,但是在第十次测试后,我得到了MaxListenersExceededWarning,然后:“致命错误:无效的标记压缩接近堆限制分配失败-JavaScript堆内存不足”。
答案 0 :(得分:0)
每个wappalyzer实例实际上都是在后台创建一个无头浏览器,因此您正在运行10个Chromium实例并进入oom状态。解决方案位于源代码中
analyze() {
this.time = {
start: new Date().getTime(),
last: new Date().getTime(),
};
return this.crawl(this.origPageUrl);
}
您只需要启动一个wappalyzer实例,然后调用url.parse来首先解析url字符串,然后将此对象传递给您的wappalyzer对象抓取方法(1个实例)。我还没有尝试使用多个实例。