Michael Baessler wrote:
Marshall Schor wrote:
The documentation for this says:

"The JCas cache ... incurs a steep memory overhead".  I think the actual
number is ~1.5 * size-of-a-java-reference (4 bytes on a 32 bit java),
per JCas object, plus the overhead of holding on to the actual JCas
cover instances longer than needed.  This latter item I think dominates
the storage usage.

I plan to change this documentation to a more in depth discussion along
the lines above, and also document how to clear the cache when it's no
longer needed, unless there are objections :-)

-Marshall

Is there a way to just clear the JCas cache? I'm trying to retrieve the size of 
the cache for a test
case and I wasn't able to.
There is a public static method, part of the JCasImpl, (not currently in the JCas Interface), called clearData(CAS cas).

You pass it a reference to a CAS object, and it clears JCas caches associated with that CAS (for pipelines having Pear descriptors,where class loaders are being switched, it clears *all* the caches - there is a separate cache for each class loader, since each one has a different JCas cover object class).

If nothing else in the application is referencing the individual JCas class instances, they will then be eligible for garbage collection.

There isn't currently an API to retrieve the sizes of the caches. You can see some commented-out code in JCasImpl source in the clearData method which prints the sizes to system.out, though.

-Marshall

Reply via email to