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

  • SEARCH
  • Home
  • 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 8203199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:28:07+00:00 2026-06-07T07:28:07+00:00

Problem – Memory Utilization keeps growing in my program when parsing an XML string.

  • 0

Problem – Memory Utilization keeps growing in my program when parsing an XML string.

I have an XML stream coming in live on a TCP port.
I use Netty to pull the xml data out and then I use XStream to deserialize/unmarshal the XML String into Java Object tree.

When I monitor memory consumption using netbeans profile, I see the HEAP growing over time and then finally JVM throws OutOfMemory exception.
I traced the call Stack and I’ve attached a screenshot of one my tests in action.

The memory consumption seems to be happening when I deserialize/unmarshal the XML String into Java Objects.

I’ve tried different parsers within XStream to do the parsing – XPP3,KXML,STAX. I’ve even tried JAXB instead of XStream to unmarshal.
No matter what parser I use, the problem persists.

I’ve tried all these different parsers so far but I have the same issue.

  xstream1 = new XStream(new KXml2Driver());
  xstream2 = new XStream(new StaxDriver());
  xstream3 = new XStream(new JDomDriver());
  xstream4 = new XStream(new Xpp3Driver());

Like I mentioned,I’ve even tried JAXB to unmarshal instead of XStream…still same issue.

If you look at the attached image, its this Arrays.copyOfRange call right under the char[] that shows up….
No matter which parser it is, this call always shows up at the top of the trace.

I’m completely lost on how to fix or approach this problem

PLS NOTE – I’m not reading XML from a file. I get a live stream of data containing small XML chunks. I extract each chunk to convert it into Java objects for further processing

Thanks
A
Allocation Stack Trace from Memory Consumption data pulled using Netbeans Profiler

  • 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-07T07:28:09+00:00Added an answer on June 7, 2026 at 7:28 am

    Well, on the evidence you’ve shown us, the simplest explanation is that your JVM’s heap is too small. Try adding an “-Xmx” option as described in the manual entry for the java command.

    If that doesn’t work, then you need to take a deeper look at what your application is doing:

    • Is there an upper bound on the size of these “small” XML chunks? Could you be getting a chunk that is bigger than you have allowed for?

    • Is your application’s processing keeping stuff from each chunk in a long lived in-memory data structure? Can you place an upper bound on the size of that data structure? Perhaps by throwing stuff out? (Or by using “weak references” so that the GC will throw them out?)

    • Is your application leaking memory?

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

Sidebar

Related Questions

Problem: I have a table that prints out vertical but I would like it
Problem: I have two array where one produce a category and the second produce
Problem Using Director 11.5 and Windows 7, with MouseWheel Xtra (wheelmouse.zip), I have the
Problem occured when i tried to display xml data that has been taken by
So to start, I have an array of XML files. These files need to
Problem Description: We have a service which has applications for main mobile OS’s. We
Problem! I Have the following input (rules) from a flat file (talking about numeric
Problem PHP session in different folder. I have problem with PHP session. There are
Problem: I wrote a hello world java program, compiled and created a jar file
Problem I have a xib file with a UIImageView over the top of 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.