[jdom-interest] maximum String length?

Bart Read bart at wdi.co.uk
Tue Jul 10 08:04:00 PDT 2001

As far as I'm aware Java does not set limitations on the maximum size of any
object as long as their is enough free memory.  The only time you might have
problems in this regard is if you try to return your large String as the
result of a remote method invocation -- it'll probably complain that it's
unexpectedly reached the end of the stream (this might affect parameters
used in RMI calls as well, I don't know).  If you do encounter problems with
this (OutOfMemoryError) you might want to try playing with Java's
non-standard runtime options; something like this:

java -Xmx128M <your-class-name-here>

which increases the maximum heap space available to your application to 128M
(put whatever value you want here, the default is around 85M as far as I can

Hope this helps,

Bart Read
Senior Developer
Abbotsbury Software Ltd
Abbotsbury, DORSET DT3 4JT
Tel: +44 (0) 1305 871644
E-mail: bart at wdi.co.uk
----- Original Message -----
From: "Cem Karan" <Cem.Karan at usa.alcatel.com>
To: <jdom-interest at jdom.org>
Sent: Monday, July 09, 2001 6:25 PM
Subject: [jdom-interest] maximum String length?

> Hey all, I hope someone can answer this.  I need to store a moderately
> long String in an XML file as a single String.  That means that when I
> access it, I'm going to be getting back something that is somewhere
> under 10,000 characters long.  I have plenty of memory for this
> application, so I'm not worried about allocating a String thats that
> size, but I don't know if there is a built-in limitation in either Java
> or JDom.  I know that in pascal, the first byte is always used to
> indicate the length of the String, which is why its limited to 255
> characters in a string, but I haven't seen anything indicating if Java
> or JDom has this type of limitation or not.  Does anyone know for sure?
> Thanks,
> Cem Karan
> _______________________________________________
> To control your jdom-interest membership:
> ---------- Automatically inserted by mailhost.wdi.co.uk ------------
> This message has been scanned for virus, trojans, illegal relays and
> spam. If you have any comments, problems or questions please do not
> hesitate to contact:
> Abbotsbury Software Ltd
> Tel: +44 1305 871543 Fax: +44 1305 871688
> Email: postmaster at wdi.co.uk
> Web: http://www.wdi.co.uk/virus.phtml

More information about the jdom-interest mailing list