Programmer-yyds opened a new issue, #879: URL: https://github.com/apache/poi/issues/879
**Environment:** - Java 21 - Apache POI 5.4.0 **Description:** When using Apache POI to export an XLSX file containing a large number of images, the program encounters an OOM error. To mitigate the memory issue, I added the following configuration: ``` static { ZipPackage.setUseTempFilePackageParts(true); } ``` This configuration successfully resolved the OOM problem, but introduced a new issue: - A large number of temporary files are created during the XLSX file generation process - These temporary files are **not** automatically deleted after the program finishes - Frequent exports cause temporary files to accumulate, eventually exhausting container disk space **Expected Result:** - Provide an automatic cleanup mechanism for temporary files, or release the related temporary file resources when the `Workbook` is closed - If cleanup cannot be done on close, in multi-threaded scenarios, generate separate temporary file directories for each file to distinguish them and safely clean up **Steps to Reproduce:** 1. Create an export logic for an XLSX file containing many images 2. Enable `ZipPackage.setUseTempFilePackageParts(true)` 3. Repeatedly perform the export operation and observe the temporary file directory (e.g., `/tmp`) **Impact:** - A large number of temporary files occupy disk space, potentially exhausting container storage **Temporary Workaround & Limitations:** - Manually clean up temporary files, but with the following issues: - In a multi-threaded environment, all threads write temporary files to the same directory - Cannot distinguish between temporary files from completed exports and those still being generated - Deleting files blindly may corrupt files that are still being created -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org