Page 1 of 1

Heap Space errors

PostPosted: 18 May 2011, 20:33
by DennisBergkamp
I've attempted to convert the Shandalar quest IO code into the new XML questData IO (which also uses the new Deck class, which does not implement Serializable, so gives me trouble when I try the old IO).
However, I'm running into some Heap Space errors in this piece of code, which has been copied from loadData() in QuestDataIO.java:

Code: Select all
...
while (reader.ready()) {
               System.out.println("count: "+ count++);
                int len = reader.read(buf);
                xml.append(buf, 0, len); //<--- here
}
I've tried increasing my eclipse heap size to 512 megs, 1gig/2gigs, but it always breaks trying to append something to the xml StringBuilder at the same point (count = 65599).

Now, I'm storing a lot more stuff in Adventure_QuestData.java compared to the regular old QuestData, which also includes a lot of ArrayLists and Maps (which probably explains why this count is so ridiculously high).
Any ideas anyone? In particular, whoever ported the Quest code to use the new XML format. Maybe it's just not feasible to use XML when using a bunch of Maps.

I can always use the old IO / Deck code, I suppose.

Re: Heap Space errors

PostPosted: 18 May 2011, 20:52
by DennisBergkamp
Ah wow, I just checked the Adventure_QuestData.dat file it tried to read, which is 12.8 Megabytes! And this is a "new" quest. I'm guessing it must add a lot of xml tags when using maps? Clearly something is going wrong here.

Re: Heap Space errors

PostPosted: 18 May 2011, 21:10
by Chris H.
DennisBergkamp wrote:Any ideas anyone? In particular, whoever ported the Quest code to use the new XML format. Maybe it's just not feasible to use XML when using a bunch of Maps.
`
Try sending a pm to Fnoed or send an email to the contributer evrkaraca. He stops by once or twice a week to quickly scan the messages.

Re: Heap Space errors

PostPosted: 20 May 2011, 19:49
by DennisBergkamp
Ok, for now I just reverted it (I still have the code that uses the new IO / Deck stuff).