[jdom-interest] JDOM and memory

Rolf Lear jdom at tuis.net
Sat Jan 28 16:49:18 PST 2012



On 28/01/2012 5:31 PM, Michael Kay wrote:
>
>> In many places 1,000,000 strings is not a lot....
>>
> The Saxon NamePool is optimized for much lower numbers than this: it's
> rare to have more than a couple of thousand element and attribute names.
> The only time I've seen large numbers reached is with pathological
> applications that generate random namespace prefixes.
>
> Michael Kay
> Saxonica
>

I addressed this in mail I inadvertently did not send to the list, but 
to Paul only. I corrected that now.

The issue is not so much the content of one document, but the content of 
all data in a JVM. Tomcat is a prime example. Because it uses a separate 
Classloader for each installed application, it has many multiples of 
copies of classes in the perm-gen. The permgen space is limited to start 
with.... then, if these applications are doing JDOM processing then you 
are in trouble if JDOM uses the PermGen space for 'scratch' data.

PermGen is a non-obvious component of Java. Novices do not know of it, 
do not understand it's purpose, and do not know how to debug it. By way 
of example, I ran in to it using intern() and it took me days to figure 
out where the memory was going.... (years ago). Perhaps that is why I am 
so sensitive to it. Similarly, do a search for 'Tomcat PermGen' and you 
quickly understand how precious PermGen space is, it is not to be 
squandered on something that is easy to replace on the heap.

Rolf


More information about the jdom-interest mailing list