uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally (JIRA)" <uima-...@incubator.apache.org>
Subject [jira] Created: (UIMA-1111) Calling jcas.getType for a type that is not defined in the descriptor causes a lot of object allocation
Date Tue, 15 Jul 2008 20:57:31 GMT
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


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.


Mime
View raw message