You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <ui...@incubator.apache.org> on 2008/07/16 15:41:32 UTC

[jira] Assigned: (UIMA-1111) Calling jcas.getType for a type that is not defined in the descriptor causes a lot of object allocation

     [ https://issues.apache.org/jira/browse/UIMA-1111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marshall Schor reassigned UIMA-1111:
------------------------------------

    Assignee: Marshall Schor

> Calling jcas.getType for a type that is not defined in the descriptor causes a lot of object allocation
> -------------------------------------------------------------------------------------------------------
>
>                 Key: UIMA-1111
>                 URL: https://issues.apache.org/jira/browse/UIMA-1111
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>            Reporter: Adam Lally
>            Assignee: Marshall Schor
>
> This is related to UIMA-738.  if you attempt to call jcas.getType() for a type that's not defined in the type system, the JCas responds by going through the type system and re-creating all of the _Type objects for all known types.  For large type systems, this causes some unnecessary work and creates lots of temporary objects that need to be collected.
> The situation used to be worse.  Under UIMA-738 we fixed problems that caused the JCas to become unstable after this operation.  Now at least it doesn't break anything, but there is this performance issue.
> To check this, you can run the existing method in JCasTests:
>   public void testUndefinedType() throws Exception {
>     //create jcas with no type system
>     JCas jcas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null).getJCas();
>     jcas.setDocumentText("This is a test.");
>     try {
>       //this should throw an exception
>       jcas.getType(Sentence.type);
>       fail(); 
>     } catch(CASRuntimeException e) {
>     }
>     //check that this does not leave JCAS in an inconsistent state
>     //(a check for bug UIMA-738)
>     Iterator iter = jcas.getAnnotationIndex().iterator();
>     assertTrue(iter.hasNext());
>     Annotation annot = (Annotation)iter.next();
>     assertEquals("This is a test.", annot.getCoveredText());
>   }
> The call to jcas.getType(Sentence.type) will cause all known _Type objects to be instantiated (in this case, the builtins).  This can be seen from stepping into this method in the debugger, or from putting a breakpoint in the TOP_Type constructor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.