Loading of 17MB PPTX in Java Consumes Nearly 1500MB of Memory

Hello, using Aspose Slides for Java 25.2. Loading of 17MB PPTX consumes nearly 1500MB of memory.

This code is used to

private static class HandleSaveProgress implements IProgressCallback {
    @Override
    public void reporting(double progressValue) {
        logJavaMemory(String.format("Memory at %.2f progress:", progressValue));
    }
}

private static void logJavaMemory(String msg) {
    Runtime runtime = Runtime.getRuntime();
    long usedMemory = runtime.totalMemory() - runtime.freeMemory();
    double usedMemoryInMB = usedMemory / (1024.0 * 1024.0);
    String usedMemoryString = String.format("Used Memory: %.2f MB", usedMemoryInMB);
    LOGGER.debug(msg + ": " + usedMemoryString);
}

LoadOptions loadOptions = new LoadOptions();
loadOptions.getBlobManagementOptions().setPresentationLockingBehavior(PresentationLockingBehavior.KeepLocked);
loadOptions.getBlobManagementOptions().setTemporaryFilesAllowed(true);
loadOptions.getBlobManagementOptions().setTempFilesRootPath(tempDirectory.toString());
loadOptions.getBlobManagementOptions().setMaxBlobsBytesInMemory(512 * 1024 * 1024); // 512MB

PdfOptions saveOptions = new PdfOptions();

saveOptions.setCompliance(AsposeContants.SLIDES_PDF_FORMAT);
saveOptions.setProgressCallback(new HandleSaveProgress());

Presentation presentation = new Presentation(inputFile, loadOptions);
try {
    presentation.save(outFile, SaveFormat.Pdf, saveOptions);
    logJavaMemory("Memory after saving pdf");
} finally {
    presentation.dispose();
}

Attaching the memory log.
AsposeSlidesMemory.zip (3.5 KB)

@AlesGregor

It seems that you are experiencing high memory consumption when loading a 17MB PPTX file using Aspose Slides for Java. This can happen due to the way presentations are managed in memory, especially with large files.

To mitigate memory usage, you can utilize the BlobManagementOptions in your LoadOptions. Specifically, setting the PresentationLockingBehavior to KeepLocked allows the presentation to be locked for the instance’s lifetime without loading it entirely into memory. This can help reduce the memory footprint significantly.

Here’s an example of how you can implement this:

LoadOptions loadOptions = new LoadOptions();
loadOptions.getBlobManagementOptions().setPresentationLockingBehavior(PresentationLockingBehavior.KeepLocked);
loadOptions.getBlobManagementOptions().setTemporaryFilesAllowed(true);
loadOptions.getBlobManagementOptions().setTempFilesRootPath(tempDirectory.toString());
loadOptions.getBlobManagementOptions().setMaxBlobsBytesInMemory(512 * 1024 * 1024); // 512MB

Presentation presentation = new Presentation(inputFile, loadOptions);
try {
    // Perform operations on the presentation
} finally {
    presentation.dispose();
}

By using the KeepLocked behavior, you can work with large presentations while keeping memory usage lower. Additionally, ensure that you dispose of the Presentation object properly to free up resources after you are done.

If you continue to experience issues, consider checking the memory logs you provided to identify any specific areas where memory usage spikes occur. This can help in further optimizing your code.

If you have any more questions or need further assistance, feel free to ask!

If you look more closely to the code example I have posted, you will see that the solution with loadOptions.getBlobManagementOptions(), that you are proposing, is the exactly same code as I am using. It is not helping.

@AlesGregor,
We are sorry that you encountered this problem. We would greatly appreciate it if you could share more details to help us investigate the issue. Please share the following:

  • sample presentation file
  • OS version on which the code was executed
  • JDK target version in your application project

Please also specify the compliance format in the following code line:

saveOptions.setCompliance(AsposeContants.SLIDES_PDF_FORMAT);

Hello @andrey.potapov ,

I observe this issue on different Linux distributions as well as on Windows using Java 11.

e.g.: Operating System: Linux 5.15.167.4-microsoft-standard-WSL2
Java version: 11.0.24

Operating System: Windows 10 10.0
Java version: 11.0.21

The AsposeContants.SLIDES_PDF_FORMAT = om.aspose.slides.PdfCompliance.PdfA2u;

Is there any way to share the source PPTx file with you privately?

I can share smaller PPTX file that consumes up to 1GB of memory.

blabla.zip (2.6 MB)

If the JVM memory is limited to 500MB ( -Xmx500m ) I see java.lang.OutOfMemoryError: Java heap space.

Best Regards
Ales

@AlesGregor,
Thank you for the details.

Please follow the instructions described in How to Send License File to Support Team to send us the source PPTX file. Then I will mark it as confidential data.

@AlesGregor,

I’ve reproduced the problem where converting a PowerPoint presentation to a PDF document consumes more than 1GB of memory.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39643

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you found earlier (filed as SLIDESJAVA-39643) have been resolved in Aspose.Slides for Java 25.8 (Maven, JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

@AlesGregor,
Our developers have analyzed and optimized memory usage during presentation-to-PDF conversion. Because this process doesn’t require certain data stored in the presentation object, we strongly recommend the following method for converting to PDF when RAM is limited: Convert.toPdf

Code example:

PdfOptions saveOptions = new PdfOptions();
saveOptions.setCompliance(PdfCompliance.PdfA2u);
saveOptions.setProgressCallback(new HandleSaveProgress());
Convert.toPdf("test.pptx", "output.pdf", saveOptions);
private static class HandleSaveProgress implements IProgressCallback {
    @Override
    public void reporting(double progressValue) {
        logJavaMemory(String.format("Memory at %.2f progress.", progressValue));
    }
}

private static void logJavaMemory(String msg) {
    Runtime runtime = Runtime.getRuntime();
    long usedMemory = runtime.totalMemory() - runtime.freeMemory();
    double usedMemoryInMB = usedMemory / (1024.0 * 1024.0);
    String usedMemoryString = String.format(" Used Memory: %.2f MB", usedMemoryInMB);
    System.out.println(msg + usedMemoryString);
}

Using the Convert.toPdf method with Aspose.Slides for Java 25.8, 500 MB of RAM is sufficient to convert this PPTX presentation to PDF.
Output:

Memory at 0,00 progress. Used Memory: 247,17 MB
Memory at 0,56 progress. Used Memory: 257,01 MB
Memory at 1,12 progress. Used Memory: 271,21 MB
Memory at 1,69 progress. Used Memory: 259,03 MB
Memory at 2,25 progress. Used Memory: 313,14 MB
Memory at 2,81 progress. Used Memory: 234,16 MB
Memory at 3,37 progress. Used Memory: 244,47 MB
Memory at 3,93 progress. Used Memory: 323,82 MB
Memory at 4,49 progress. Used Memory: 341,45 MB
Memory at 5,06 progress. Used Memory: 265,44 MB
Memory at 5,62 progress. Used Memory: 319,54 MB
Memory at 6,18 progress. Used Memory: 274,72 MB
Memory at 6,74 progress. Used Memory: 361,27 MB
Memory at 7,30 progress. Used Memory: 315,20 MB
Memory at 7,87 progress. Used Memory: 345,36 MB
Memory at 8,43 progress. Used Memory: 404,42 MB
Memory at 8,99 progress. Used Memory: 355,25 MB
Memory at 9,55 progress. Used Memory: 282,26 MB
Memory at 10,11 progress. Used Memory: 311,55 MB
Memory at 10,67 progress. Used Memory: 300,48 MB
Memory at 11,24 progress. Used Memory: 331,34 MB
Memory at 11,80 progress. Used Memory: 291,45 MB
Memory at 12,36 progress. Used Memory: 310,08 MB
Memory at 12,92 progress. Used Memory: 322,05 MB
Memory at 13,48 progress. Used Memory: 333,10 MB
Memory at 14,04 progress. Used Memory: 291,15 MB
Memory at 14,61 progress. Used Memory: 383,27 MB
Memory at 15,17 progress. Used Memory: 342,69 MB
Memory at 15,73 progress. Used Memory: 309,87 MB
Memory at 16,29 progress. Used Memory: 293,38 MB
Memory at 16,85 progress. Used Memory: 313,03 MB
Memory at 17,42 progress. Used Memory: 347,69 MB
Memory at 17,98 progress. Used Memory: 436,57 MB
Memory at 18,54 progress. Used Memory: 353,06 MB
Memory at 19,10 progress. Used Memory: 463,27 MB
Memory at 19,66 progress. Used Memory: 334,63 MB
Memory at 20,22 progress. Used Memory: 445,25 MB
Memory at 20,79 progress. Used Memory: 341,27 MB
Memory at 21,35 progress. Used Memory: 350,65 MB
Memory at 21,91 progress. Used Memory: 266,28 MB
Memory at 22,47 progress. Used Memory: 401,35 MB
Memory at 23,03 progress. Used Memory: 382,61 MB
Memory at 23,60 progress. Used Memory: 316,65 MB
Memory at 24,16 progress. Used Memory: 289,37 MB
Memory at 24,72 progress. Used Memory: 390,37 MB
Memory at 25,28 progress. Used Memory: 384,57 MB
Memory at 25,84 progress. Used Memory: 357,53 MB
Memory at 26,40 progress. Used Memory: 323,73 MB
Memory at 26,97 progress. Used Memory: 424,56 MB
Memory at 27,53 progress. Used Memory: 303,38 MB
Memory at 28,09 progress. Used Memory: 350,71 MB
Memory at 28,65 progress. Used Memory: 391,93 MB
Memory at 29,21 progress. Used Memory: 434,82 MB
Memory at 29,78 progress. Used Memory: 343,86 MB
Memory at 30,34 progress. Used Memory: 418,17 MB
Memory at 30,90 progress. Used Memory: 418,42 MB
Memory at 31,46 progress. Used Memory: 430,74 MB
Memory at 32,02 progress. Used Memory: 377,10 MB
Memory at 32,58 progress. Used Memory: 422,43 MB
Memory at 33,15 progress. Used Memory: 436,38 MB
Memory at 33,71 progress. Used Memory: 374,82 MB
Memory at 34,27 progress. Used Memory: 397,20 MB
Memory at 34,83 progress. Used Memory: 361,07 MB
Memory at 35,39 progress. Used Memory: 336,00 MB
Memory at 35,96 progress. Used Memory: 426,36 MB
Memory at 36,52 progress. Used Memory: 375,54 MB
Memory at 37,08 progress. Used Memory: 399,09 MB
Memory at 37,64 progress. Used Memory: 417,53 MB
Memory at 38,20 progress. Used Memory: 345,01 MB
Memory at 38,76 progress. Used Memory: 372,31 MB
Memory at 39,33 progress. Used Memory: 404,64 MB
Memory at 39,89 progress. Used Memory: 440,70 MB
Memory at 40,45 progress. Used Memory: 276,08 MB
Memory at 41,01 progress. Used Memory: 288,12 MB
Memory at 41,57 progress. Used Memory: 305,39 MB
Memory at 42,13 progress. Used Memory: 339,35 MB
Memory at 42,70 progress. Used Memory: 354,23 MB
Memory at 43,26 progress. Used Memory: 363,50 MB
Memory at 43,82 progress. Used Memory: 342,37 MB
Memory at 44,38 progress. Used Memory: 372,80 MB
Memory at 44,94 progress. Used Memory: 291,42 MB
Memory at 45,51 progress. Used Memory: 297,48 MB
Memory at 46,07 progress. Used Memory: 301,50 MB
Memory at 46,63 progress. Used Memory: 333,40 MB
Memory at 47,19 progress. Used Memory: 299,97 MB
Memory at 47,75 progress. Used Memory: 331,50 MB
Memory at 48,31 progress. Used Memory: 349,79 MB
Memory at 48,88 progress. Used Memory: 311,82 MB
Memory at 49,44 progress. Used Memory: 348,65 MB
Memory at 50,00 progress. Used Memory: 314,63 MB
Memory at 50,56 progress. Used Memory: 354,65 MB
Memory at 51,12 progress. Used Memory: 316,94 MB
Memory at 51,69 progress. Used Memory: 338,74 MB
Memory at 52,25 progress. Used Memory: 312,29 MB
Memory at 52,81 progress. Used Memory: 337,71 MB
Memory at 53,37 progress. Used Memory: 312,35 MB
Memory at 53,93 progress. Used Memory: 345,24 MB
Memory at 54,49 progress. Used Memory: 349,44 MB
Memory at 55,06 progress. Used Memory: 384,86 MB
Memory at 55,62 progress. Used Memory: 344,51 MB
Memory at 56,18 progress. Used Memory: 368,85 MB
Memory at 56,74 progress. Used Memory: 347,90 MB
Memory at 57,30 progress. Used Memory: 302,54 MB
Memory at 57,87 progress. Used Memory: 318,01 MB
Memory at 58,43 progress. Used Memory: 352,21 MB
Memory at 58,99 progress. Used Memory: 339,39 MB
Memory at 59,55 progress. Used Memory: 378,59 MB
Memory at 60,11 progress. Used Memory: 400,39 MB
Memory at 60,67 progress. Used Memory: 382,65 MB
Memory at 61,24 progress. Used Memory: 427,63 MB
Memory at 61,80 progress. Used Memory: 438,99 MB
Memory at 62,36 progress. Used Memory: 364,48 MB
Memory at 62,92 progress. Used Memory: 430,11 MB
Memory at 63,48 progress. Used Memory: 413,38 MB
Memory at 64,04 progress. Used Memory: 352,26 MB
Memory at 64,61 progress. Used Memory: 360,43 MB
Memory at 65,17 progress. Used Memory: 409,21 MB
Memory at 65,73 progress. Used Memory: 339,77 MB
Memory at 66,29 progress. Used Memory: 396,00 MB
Memory at 66,85 progress. Used Memory: 422,06 MB
Memory at 67,42 progress. Used Memory: 322,19 MB
Memory at 67,98 progress. Used Memory: 355,64 MB
Memory at 68,54 progress. Used Memory: 436,62 MB
Memory at 69,10 progress. Used Memory: 348,26 MB
Memory at 69,66 progress. Used Memory: 415,22 MB
Memory at 70,22 progress. Used Memory: 327,06 MB
Memory at 70,79 progress. Used Memory: 345,94 MB
Memory at 71,35 progress. Used Memory: 384,16 MB
Memory at 71,91 progress. Used Memory: 412,34 MB
Memory at 72,47 progress. Used Memory: 419,96 MB
Memory at 73,03 progress. Used Memory: 439,40 MB
Memory at 73,60 progress. Used Memory: 349,97 MB
Memory at 74,16 progress. Used Memory: 377,42 MB
Memory at 74,72 progress. Used Memory: 400,30 MB
Memory at 75,28 progress. Used Memory: 429,47 MB
Memory at 75,84 progress. Used Memory: 443,59 MB
Memory at 76,40 progress. Used Memory: 365,95 MB
Memory at 76,97 progress. Used Memory: 307,62 MB
Memory at 77,53 progress. Used Memory: 378,35 MB
Memory at 78,09 progress. Used Memory: 404,45 MB
Memory at 78,65 progress. Used Memory: 333,79 MB
Memory at 79,21 progress. Used Memory: 386,57 MB
Memory at 79,78 progress. Used Memory: 408,07 MB
Memory at 80,34 progress. Used Memory: 383,91 MB
Memory at 80,90 progress. Used Memory: 310,21 MB
Memory at 81,46 progress. Used Memory: 405,74 MB
Memory at 82,02 progress. Used Memory: 413,85 MB
Memory at 82,58 progress. Used Memory: 400,33 MB
Memory at 83,15 progress. Used Memory: 407,86 MB
Memory at 83,71 progress. Used Memory: 335,39 MB
Memory at 84,27 progress. Used Memory: 347,63 MB
Memory at 84,83 progress. Used Memory: 414,64 MB
Memory at 85,39 progress. Used Memory: 398,55 MB
Memory at 85,96 progress. Used Memory: 408,75 MB
Memory at 86,52 progress. Used Memory: 352,41 MB
Memory at 87,08 progress. Used Memory: 361,53 MB
Memory at 87,64 progress. Used Memory: 430,02 MB
Memory at 88,20 progress. Used Memory: 402,72 MB
Memory at 88,76 progress. Used Memory: 382,41 MB
Memory at 89,33 progress. Used Memory: 362,64 MB
Memory at 89,89 progress. Used Memory: 364,60 MB
Memory at 90,45 progress. Used Memory: 354,43 MB
Memory at 91,01 progress. Used Memory: 429,55 MB
Memory at 91,57 progress. Used Memory: 411,49 MB
Memory at 92,13 progress. Used Memory: 373,96 MB
Memory at 92,70 progress. Used Memory: 431,08 MB
Memory at 93,26 progress. Used Memory: 418,62 MB
Memory at 93,82 progress. Used Memory: 366,16 MB
Memory at 94,38 progress. Used Memory: 306,00 MB
Memory at 94,94 progress. Used Memory: 364,02 MB
Memory at 95,51 progress. Used Memory: 318,69 MB
Memory at 96,07 progress. Used Memory: 361,95 MB
Memory at 96,63 progress. Used Memory: 322,12 MB
Memory at 97,19 progress. Used Memory: 319,31 MB
Memory at 100,00 progress. Used Memory: 345,35 MB

Hello @andrey.potapov, thank You for the information. This is very good news.

By the way is there any reason to see “The subscription included in this license allows free upgrades until 2025-08-29, but this version of the product was released on 2025-08-31. Please renew the subscription or use a previous version of the product.” while the the release date of 25.8 is per Aspose.Slides | Java Library to Process PowerPoint Formats August 15, 2025 ?

@AlesGregor,
Thanks for checking. Our monthly releases are timestamped with the last calendar day of the month, and that date is what the license check uses. While the 25.8 announcement was published on August 15, 2025, the official release date for licensing is August 31, 2025. Because your subscription includes free upgrades through August 29, 2025, version 25.8 falls outside the covered period. To use 25.8, please renew the subscription; otherwise, you can continue with the previous version.