dev@jaxb.java.net

Re: How the caching is done in JAXB

From: Matthias Ernst <matthias_at_mernst.org>
Date: Fri, 28 Nov 2008 11:31:43 +0100

On Fri, Nov 28, 2008 at 11:31 AM, Matthias Ernst
<ernst.matthias_at_gmail.com> wrote:
> On Fri, Nov 28, 2008 at 7:43 AM, Naresh Tallapelli
> <naresh.tallapelli_at_gmail.com> wrote:
>> Hi All,
>>
>> Iam using jaxb version 2.1.8. When i pass a huge file 250MB for JAXB
>> Marshaller it is throwing "out of memory error". So i want to know how the
>> JAXB is implementing Cache. Whether it is using Memory cache (Map) or Disk
>> level cache (Ehcache). If JAXB is using Ehcache, can we configure it to
>> suit our needs. Can anyboly please provide a solution to my problem with out
>> increasing the Java Heap size.
>
> This has nothing to do with caching. JAXB builds an in-memory object
> tree of the whole file and that obviously gets too big. I suppose you
> have a repeating element at the top level - in that case you should
> look at this thread:
>
> http://markmail.org/search/?q=SAX-like+JAXB#query:SAX-like%20JAXB+page:1+mid:skdfvjy56zfp6alt+state:results
>
> Some sample code is attached here. I don't know whether it actually
> made it to the JAXB samples:
>
> http://markmail.org/search/?q=SAX-like+JAXB#query:SAX-like%20JAXB+page:2+mid:h3b56nnmqywrojpd+state:results
>
> Matthias
>