Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


JEP Singleton?

  • Calvin

    Just curious about the best practices of using JEP.  I noticed creating a new instance of JEP also comes with hundreds of objects that the parser depends on.  There are noticeable memory problems when the application creates many instances of JEP.

    Should JEP be used as a singleton object?


    • Nathan Funk
      Nathan Funk

      It depends on your application. If you have multiple threads you would need to be careful. If you have a single thread, then yes, using JEP as a singleton is definitely recommended if you are running into memory issues.

      Please from now on post on the new Jep forums at


      Best regards,

      Nathan Funk

    • There are ways in which you can minimise the space usage. There issues have been given a lot of attention in the Jep 3.2 release see
      which explains details of efficiently working with threads. Basically you can create new light-weight jep classes which  share some components, like the parser, but creates those parts which are necessary for thread-safe operation, (the evaluator, variable table and expressions).

      In 2.4 release there are some facilities offered by the djep extensions, in particular the org.lsmp.djep.xjep.xJep class see org.lsmp.djepExamples.ThreadTest for examples.