'ArrayList - java.lang.OutOfMemoryError: Java heap space
the problem is that there are more than a million entries in my list, after which it falls. I need the whole list to pass it to jasper to generate a report. Can someone tell me how to deal with this? Maybe there are some utilities for this (compact in terms of memory collections)
List<ReportDTO> resultReportDTOS = new ArrayList<>(); //More than a million
for (int id : params.getIds()) {
List<ReportDTO> reportDTOs = reportRepository.getDataSource(params.getProjectId(), id);
resultReportDTOS.addAll(reportDTOs);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
