We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Slides 20.10 Causes OOM Problems Loading Fonts - macOS

We recently attempted an upgrade to Aspose.Slides 20.10 (Java). We found it stable for Linux and Windows, but found it to cause a lot of out-of-memory problems when running on macOS. For example:

java.lang.OutOfMemoryError: Java heap space
	at com.aspose.slides.internal.e7.void.setCapacity(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.e7.void.b(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.e7.void.write(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.m8.if.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.l0.try.if(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.e5.new.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.n2.implements.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.n5.final.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.n5.final.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.internal.n5.final.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.FontsLoader.do(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]
	at com.aspose.slides.FontsLoader.loadExternalFonts(Unknown Source) ~[aspose-slides-20.10-jdk16.jar:20.10]

Presently, with 20.10, we are only able to run our software stably on macOS if we use a heap exceeding 8GB; this seems like a significant amount of memory just for fonts. When executing FontsLoader.loadExternalFonts, we notice that on Windows the standard font directory (e.g, C:/Windows/Fonts) consumes about 384MB on disk. However, on macOS, the standard font directories (e.g., /System/Library/Fonts/Supplemental, /System/Library/Fonts, etc.) cumulatively exceed 700MB on disk.

If we revert to a previous version of Aspose.Slides (e.g., 20.2), we do not need 8GB heap space on macOS.

This seems like a clear regression, and we cannot expect consumers of our software to assign 8GB+ to heap. Can we expect this regression to be resolved in 20.11?

@nuix

There has been a similar thread shared by you recently as well. We may need to investigate this and for this we will request you to please share Java details, Source presentation and used sample code. We will add the issue in our issue tracking system to further investigate and resolve the issue.

This particular issue doesn’t require source data. And this issue is unrelated to our other ticket.

As clearly stated above, just call FontsLoader.loadExternalFonts on macOS with some of the font directories mentioned. You should find that when the font directories cumulatively exceed 700MB you’ll encounter OOM exceptions unless you bump xmx really high.

@nuix

I have create an issue with ID SLIDESJAVA-38350 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-38350) have been fixed in this update.

We tried version 21.1. We ran into OOM errors again; our developers and users are requiring questionably large heap sizes in order to load macOS’s font directories.
Please re-open this ticket and fix it properly this time.

java.lang.OutOfMemoryError: Java heap space
at com.aspose.slides.internal.fs.void.toArray(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.mv.try.if(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.fq.new.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.on.implements.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.oq.final.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.oq.final.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.internal.oq.final.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.FontsLoader.do(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]
at com.aspose.slides.FontsLoader.loadExternalFonts(Unknown Source) ~[aspose-slides-21.1-jdk16.jar:21.1]

@nuix

Can you please share the heap size that you are considering higher and that is proving to avoid exception. Please also share that what heap size you are using to reproduce the OOM exception.

We are finding we need an XMX value of 8GB to run our application on macOS, whereas we only need 2GB on Windows/Linux.

We have previously pointed out this is most likely a font-loading issue.

@nuix

We will get back to you with feedback as soon as our product team will share in this regard.

Thanks. It’s a clear regression; the problem is not evident, in version 20.2, for example. Perhaps fonts should be loaded on demand, rather than attempting to hold every single font in memory.

@nuix

We have checked the behaviour of Aspose.Slides for Java 21.1 on Linux and MacOS. We have used approximately 2Gb of external fonts with Xmx2Gb.

System.out.println("FontFamilies count : " + GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts().length);
System.out.println("Memory before loading : " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
FontsLoader.loadExternalFonts(new String[] {
        "path/to/fonts"});
System.out.println("FontFamilies count : " + GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts().length);
System.out.println("Memory after loading : " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));

We have got the following results:

Aspose.Slides for Java 21.1

MacOS Linux
FontFamilies count 627 72
Memory before loading 46.908.152 22.843.096
FontFamilies count 1.592 1.115
Memory after loading 1.368.953.424 1.319.130.608

Aspose.Slides for Java 20.2

MacOS Linux
FontFamilies count 627 72
Memory before loading 37.748.736 21.974.960
FontFamilies count 1.706 1.229
Memory after loading 1.668.667.704 1.600.900.888

Aspose.Slides 20.2 loaded more families, because in certain cases Aspose.Slides 20.2 duplicates existed font families (We fixed this in 20.12).

Since you are still facing the problem, can you please share the following information:

  • MacOS and Linux versions
  • JDK version
  • Sample project to reproduce
  • Full list of used fonts (in ZIP)

This is the code that is causing us problems in macOS:

logger.info(“Initialising Aspose.Slides from font dirs: {}”, Arrays.toString(fontDirs));
FontsLoader.loadExternalFonts(fontDirs);

This produces the log line prior to OOM with xmx2g:

2021-02-16 11:14:34.854 +1100 [main] 13334 INFO com.nuix.data.util.aspose.a - Initialising Aspose.Slides from font dirs: [/Users/foo/Library/Fonts, /Library/Fonts, /Network/Library/Fonts, /System/Library/Fonts, /System/Library/Fonts/Supplemental, /System Folder/Fonts]

where I have changed the username to “foo” for privacy.

The Mac we used is running macOS 10.14.6. Attached is a list of fonts, as requested (fonts.txt.zip).

Out of interest, what font path are you using for FontsLoader.loadExternalFonts ?

fonts.txt.zip (2.0 KB)

To be clear, using the provided directories mentioned above on the same Mac, we have no problems with 20.2, but encounter OOM errors with with 21.1. With either version of Aspose Slides we’re providing the same font paths / same fonts.

@nuix

I have included the information in our issue tracking system and will share feedback with you as soon as it will be addressed.

@nuix

We have addressed the issue in upcoming version of Aspose.Slides for Java 21.2 and have shared the pre-release version (https://drive.google.com/file/d/1NbdjWhtTNy1u3X_9I0rk5z_ZKL_8E4oY/view?usp=sharing) for your convenience so that you can verify on your end. Please feel free to use that and share the feedback with us.

FontsLoader.loadExternalFonts(new String[] {
     "/Users/foo/Library/Fonts", 
     "/Library/Fonts",
     "/Network/Library/Fonts",
     "/System/Library/Fonts", 
     "/System/Library/Fonts/Supplemental",
     "/System Folder/Fonts" });

Thanks. Our build process is quite complex. Is there any chance we can access the preview version from a repo? We’re used to accessing the slides jar with a line in our dependencies.gradle file, e.g.,

aspose_slides: ['com.aspose:aspose-slides:21.1:jdk16']

Or, should we wait for 21.2 to be officially released? (In which case, when will that be?)

@nuix

Aspose.Slides for Java 21.2 will be released by end of February 2021. We will anyways share notification with you once it will be shared online.

I also have the same problems, but the OOM occurred on linux sytem.
we use 21.7 for slides by java

@Shimo,
Welcome to our community! Thank you for contacting support.

Please check your results using the latest version of Aspose.Slides. If the issue persists, please create a new forum thread and share/specify the following:

  • input presentation file
  • code example reproducing the error
  • Linux version
  • JDK version
  • full list of used fonts