Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:40:04+00:00 2026-06-14T11:40:04+00:00

I am evaluating vtd-xml as a possible solution for a large data migration project.

  • 0

I am evaluating vtd-xml as a possible solution for a large data migration project. The input data is in xml format and if vtd-xml is viable it would save a lot of dev time. I run the example Process Huge XML Documents (Bigger than 2GB) from vtd-xml website: http://vtd-xml.sourceforge.net/codeSample/cs12.html.

I successfully process 500Mb but get the dreaded java.lang.OutOfMemoryError: Java heap space error with a 4Gb file.

  1. JVM Arguments: -Xmn100M -Xms500M -Xmx2048M.
  2. JVM Arguments: -Xmn100M -Xms500M -Xmx4096M.

And with Maven:

  1. set MAVEN_OPTS=-Xmn100M -Xms500M -Xmx2048M
  2. set MAVEN_OPTS=-Xmn100M -Xms500M -Xmx4096M

NOTE: I have tested it with various combinations of the JVM arguments.

I have studied the vtd-xml site and API docs and browsed numerous questions here and elsewhere. All the awnsers point to setting the JVM memory higher or adding more physical memory. The vtd-xml website refer to memory usage of 1.3x-1.5x the xml file size but if using 64bit one should be able to process much larger files than available memerory. Surely it would also not be feasible to add 64Gb memory to process a 35Gb xml file.

Environment:

Windows 7 64 bit. 6Gb RAM. (Closed all other apps, 85% memory avaibale)

java version “1.7.0_09”

Java(TM) SE Runtime Environment (build 1.7.0_09-b05)

Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

Eclipse Indigo

Maven 2

Running the example from both Eclipse and Maven throws the Out of memory exception.

Example code:

 import com.ximpleware.extended.VTDGenHuge;
 import com.ximpleware.extended.VTDNavHuge;
 import com.ximpleware.extended.XMLMemMappedBuffer;

 public class App {

/* first read is the longer version of loading the XML file */
public static void first_read() throws Exception{
XMLMemMappedBuffer xb = new XMLMemMappedBuffer();
    VTDGenHuge vg = new VTDGenHuge();
    xb.readFile("C:\\Temp\\partial_dbdump.xml");
    vg.setDoc(xb);
    vg.parse(true);
    VTDNavHuge vn = vg.getNav();
    System.out.println("text data ===>" + vn.toString(vn.getText()));
}   

/* second read is the shorter version of loading the XML file */
public static void second_read() throws Exception{
    VTDGenHuge vg = new VTDGenHuge();
    if (vg.parseFile("C:\\Temp\\partial_dbdump.xml",true,VTDGenHuge.MEM_MAPPED)){
        VTDNavHuge vn = vg.getNav();
        System.out.println("text data ===>" + vn.toString(vn.getText()));
    }
}

public static void main(String[] s) throws Exception{
    first_read();
    //second_read();
}

}

Error:

 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.ximpleware.extended.FastLongBuffer.append(FastLongBuffer.java:209)
at com.ximpleware.extended.VTDGenHuge.writeVTD(VTDGenHuge.java:3389)
at com.ximpleware.extended.VTDGenHuge.parse(VTDGenHuge.java:1653)
at com.epiuse.dbload.App.first_read(App.java:14)
at com.epiuse.dbload.App.main(App.java:29)

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:40:05+00:00Added an answer on June 14, 2026 at 11:40 am

    You are telling Java it has a maximum heap size of 2GB and then asking it to process an XML file that is 4GB big.

    To have a chance of having this work, you need to define a maximum heap that is larger than the size of the file you are trying to process – or else change the processing mechanism to one that doesn’t need the whole file in memory at the same time.

    From their web site,

    The world’s most memory-efficient (1.3x~1.5x the size of an XML document) random-access XML parser.

    This means that for a 4GB file you need around 6GB max heap size, assuming your app doesn’t need memory for anything else.

    Try these JVM arguments:

    -Xmn100M -Xms2G -Xmx6G

    You might still run out of memory, but at least now you have a chance.

    Oh yes – and you might find your Java now fails to start because the OS can’t give java the memory it asks for. If that happens, you need a machine with more RAM (or maybe a better OS)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm performing a trade study evaluating various methods for parsing XML for a large
Evaluating Berkeley DB with Java APIs. Following is one of my test XML data:
Possible Duplicate: Evaluating a string as a mathematical expression in javascript I have written
I've been evaluating django and wondered if the following is possible. I've already looked
I'm evaluating binding a C++ project of mine in .NET, attracted by the possibility
I'm evaluating Flyway for use in my project. Our current SQL scripts contain placeholders
I'm evaluating whether WF would be a good fit for a design I'm working
I am currently evaluating for an eCommerce project. Is there any good Python based
Evaluating a third party data processing tool, I have bumped into a case where
I'm evaluating cassandra for a project of mine and I'm interested to know the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.