Using XStream to write out/read in XML memory issues

Joined
Jul 15, 2009
Messages
4
Reaction score
0
We have a larger application with a lot of static data which takes about 15-20 minutes to load up so it has the most recent values from the database. We've been able to off load this time into a seperate J2SE job which does the same thing, but then writes 20+ Map/Hashmap Objects to disk, using XStream.

We then have the application read in these XML files, again using XStream, and repopulate the maps in the application. This saves us a lot of time in restarting the application and resolves a few other issues.

For a basic flow:
J2SE Loading Job --> Xstream to XML files on disk
[XML File] --> (read) J2EE Web Application

Our basic problem seems to be that we're getting some extra objects in memory that I'm not able to trace down a root cause.

As for writing the Object (Map/HashMap) to XML:
Code:
XMLSerializationHelper.writeObjectToXMLFile(Object, "C:/data/ObjectMap.xml");

Using Helper class to write XML:
Code:
public static boolean writeObjectToXMLFile(Object objectToWriteTo, String fileName)
    {   
    	FileWriter fileWriter = null;
        
    	try {
fileWriter = new FileWriter(fileName);
            xstream.toXML(objectToWriteTo, fileWriter);
...

As for reading the XML to Object (Map/HashMap):
Code:
someMap = (Map) XMLSerializationHelper.createObjectFromXMLFile("C:/data/ObjectMap.xml");

Helper to read the XML:
Code:
public static Object createObjectFromXMLFile(String fileName) { 	

    	Object sdObject = null;
    	FileReader fileReader = null;
    	    	
    	// Create the fileReader
        try {
        	fileReader = new FileReader(fileName);
        	sdObject = xstream.fromXML(fileReader);
...

Now this works easily, quick, without many issues. What I am see though is some issues in the HeapDump of the application, ending up with quite a few of the following:

org/apache/xerces/dom/DeferredTextImpl
org/apache/xerces/dom/DeferredElementImpl

I've read about these being caused by a casting issue?

Would anyone be able to enlighten me with any tips?

T.I.A
-Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top