Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Mar 24, 2022 12:32 pm

Hi,

What is the required and recommended memory allocation (heap size) when using the Java Spire.Doc package.

I am consistently getting the below error when generating hundreds of documents using the package.

I am close to purchasing this software but this issue is making me doubt it. Can you please help?

Code: Select all
Exception in thread "pool-1-thread-109" java.lang.OutOfMemoryError: Java heap space
at com.spire.doc.packages.sprwqy.<init>(Unknown Source)
at com.spire.doc.packages.sprloy.spr???▒(Unknown Source)
at com.spire.doc.packages.sprpny.spr??(Unknown Source)
at com.spire.doc.packages.sprpny.spr??(Unknown Source)
at com.spire.doc.packages.sprmmy.spr??(Unknown Source)
at com.spire.doc.packages.sprmmy.read(Unknown Source)
at com.spire.doc.packages.sprlry.read(Unknown Source)
at com.spire.doc.packages.sprbny.spr▒??▒(Unknown Source)
at com.spire.doc.packages.sprbny.spr????▒(Unknown Source)
at com.spire.doc.packages.sprbny.spr??(Unknown Source)
at com.spire.doc.packages.sprbny.spr??(Unknown Source)
at com.spire.doc.packages.sprsxx.spr??(Unknown Source)
at com.spire.doc.packages.spripw.spr??(Unknown Source)
at com.spire.doc.packages.spripw.spr??(Unknown Source)
at com.spire.doc.packages.spripw.<init>(Unknown Source)
at com.spire.doc.packages.sprmfx.spr?▒??▒(Unknown Source)
at com.spire.doc.Document.spr???▒(Unknown Source)
at com.spire.doc.Document.spr???▒(Unknown Source)
at com.spire.doc.Document.spr?▒(Unknown Source)
at com.spire.doc.Document.loadFromStream(Unknown Source)


Thanks

cjericho
 
Posts: 17
Joined: Wed Jan 19, 2022 11:38 am

Fri Mar 25, 2022 6:47 am

Hi,

Thanks for your inquiry.
Memory consumption is related to your documents, operation code and JVM configuration. If you were not using the latest version (Spire.Doc for Java 5.3.16), I suggest you download the latest one for testing, and configure a larger JVM memory such as -Xmx4g. If the "OutOfMemoryError" still exists, please provide detailed information as below to help us better investigate your issue. You can attach your file here or send it to us via email (support@e-iceblue.com). Thank you in advance.
1) Your input documents and the runnable code that can reproduce your issue.
2) Your test environment, such as OS info (Win10, 64bit, 8GB).
3) JDK version and JVM configuration.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Thu Apr 14, 2022 11:21 am

Hi,

We have since purchased a license but the problem still exists.

The application we have is multithreaded, does Java Spire.Doc support multithreading?

Could there be a memory leak somewhere in the library?

2) Windows 10, 64-bit, 8GB
3) * openjdk 11.0.13 2021-10-19 * java -Xms2048m -Xmx4096m
Last edited by cjericho on Tue Apr 19, 2022 6:52 pm, edited 1 time in total.

cjericho
 
Posts: 17
Joined: Wed Jan 19, 2022 11:38 am

Fri Apr 15, 2022 9:27 am

Hi,

Thank you for your reply.
Spire.Doc supports creating Word documents in multi-thread. I did an initial test with the same environment as your, but still didn't encounter your issue. To help us investigate the problem and help you out quickly, please provide your full test code as well as your input documents(if any). You can attach them here or send to us via email (support@e-iceblue.com).
Sorry we did not find your purchase information according to your email. Could you please provide the authorized email address or order number for our reference? Thank you in advance.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Tue Apr 19, 2022 7:37 pm

Hi,

You are correct the authorised email address is different from my email address. The order number is 11093 and was purchased on 2022-04-07.

I have created a test project that resembles very closely what we are trying to do.

Code:
Project.zip


Template:
Project\app\src\main\resources\template-v1.1.docx

Thanks

cjericho
 
Posts: 17
Joined: Wed Jan 19, 2022 11:38 am

Wed Apr 20, 2022 10:38 am

Hi,

Thank you for your feedback.
I reproduced your problem on my side and submitted it to the developer for investigation. I will let you know as soon as the problem is resolved or there is any update. Sorry for the inconvenience.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Wed Apr 27, 2022 3:07 pm

Hi,

Is there any update on this issue?

Thanks

cjericho
 
Posts: 17
Joined: Wed Jan 19, 2022 11:38 am

Thu Apr 28, 2022 8:45 am

Hi,

Thanks for your follow-up.
Sorry there is no update on your issue at present, I have urged our dev team and they will speed up the search for solutions. If there is any meaningful progress, I will let you know immediately. Thanks for your understanding.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Tue May 24, 2022 8:57 am

Hi,

It has been a while since we reported this issue, is there any update?

Thanks

cjericho
 
Posts: 17
Joined: Wed Jan 19, 2022 11:38 am

Wed May 25, 2022 1:14 am

Hi,

Sorry our dev team haven't found a good solution to deal with it yet. Please spare us more time, if there is any meaningful progress, I will inform you. Thank you for understanding.

Sincerely
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Wed Jun 08, 2022 6:56 am

Hi,

Thank you for your patience.
We are pleased to inform you that we have released a new version that addresses your SPIREDOC-7754 problem. Please download the new version from the link below.
Download from Website: https://www.e-iceblue.com/Download/doc-for-java.html
If you downloaded from the Maven repository, please change the pom setting to:
<repositories>
<repository>
<id>com.e-iceblue</id>
<url>https://repo.e-iceblue.com/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId> e-iceblue </groupId>
<artifactId>spire.doc</artifactId>
<version>10.6.0</version>
</dependency>
</dependencies>

In addition, since java memory is limited. When thousands of documents are running at the same time, memory consumption will be too large. So I suggested you should use thread pools to manage thread tasks to avoid overflow. Please refer to the code below.
Code: Select all
public static void main(String[] args) {
    ExecutorService executorService= Executors.newFixedThreadPool(10);
    for(int i=0;i<1000;i++){
        Future future = executorService.submit(new MyRun(i));
        try {
            future. get ();
        } catch (InterruptedException e){
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
    executorService.shutdown();
}
static class MyRun implements Runnable{
    private int _Index;
    public MyRun(int index){ this. _Index= index; }
    @Override
    public void run() {
        Document document = new Document();
        document.loadFromFile(inputFile,FileFormat.Docx);
        document.setUseNewEngine(true);
        document.saveToFile(output + _Index +".pdf",FileFormat.PDF);
        document.dispose();
    }
}


Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Fri Jul 01, 2022 7:50 am

Hi,

Hope you are doing well!
Has your problem been effectively solved now? Could you give us some feedback at your convenience?
Thanks in advance.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.Doc