Jva Heap space error

hi.

I'm creating an xml file using xerces parser.

creation is fine ..

but when i try to serialise my Document object using

XMLSerialiser.serialize(xmlDoc);

i get heap space error.

i did the memory check and the memory consumption is betwenn 25% to 35%..

is there any way i can optimize serialize function?

or what can i do so that memory utilization is less.

Thanx

Richa

[440 byte] By [richa.csia] at [2007-11-27 11:54:13]
# 1

> XMLSerialiser.serialize(xmlDoc);

> i get heap space error.

> i did the memory check and the memory consumption is

> betwenn 25% to 35%..

Of what, the JVM heap or your system memory?

CeciNEstPasUnProgrammeura at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 2

Don't use Document.

cotton.ma at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 3

thanx for the reply.

if i'm not using Doc then what should i use?

thanx

richa.csia at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 4

it is the runtime memory

richa.csia at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 5

there is an error in the createxml class

sun_java_helpa at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 6

thanx for telling me my class name... :)

now could you please tell me a way around as well.. :)

cheers

richa

richa.csia at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 7

> there is an error in the createxml class

I have one doubt, but it is very large.

PHHElNa at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 8

i dont want to curb ur creativity with respect to handling it.

cheers!!

sun_java_helpa at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 9

> i dont want to curb ur creativity with respect to

> handling it.

>

> cheers!!

Wow.

PHHElNa at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 10

u can manage u r heap space memory

Just change u r -Xmin -Xmax parameter to u r available RAM size

AmitChalwade123456a at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 11

> u can manage u r heap space memory

> Just change u r -Xmin -Xmax parameter to u r

> available RAM size

Shut up.

cotton.ma at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 12

> thanx for the reply.

> if i'm not using Doc then what should i use?

>

> thanx

Use SAX serializing instead.

There are two forms of XML processing. SAX and DOM. DOM from the programmer's viewpoint is probably easier but it is more resource intensive.

When you run into memory issues processing XML the best solution is thus usually to switch to SAX processing instead. This is a more scalable solution (and thus better then increasing the heap size).

cotton.ma at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...
# 13

Thanx.

I'll try it and will let u know!!

cheers

richa.csia at 2007-7-29 18:54:41 > top of Java-index,Java Essentials,Java Programming...