Customer Portal

Out of memory error: permGen space

Comments 2

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hello John,
    The graph connection uses external linked library. All external libraries are loaded to the memory for each single graph execution. And these libraries very often contain common memory leak which causes that the library classes can't be garbage-collected when the graph execution finishes.So memory space for java classes (PermGen space) is sooner or later full and result is this exception: "java.lang.OutOfMemoryError: PermGen space".
    I can propose you two possible solutions:
    • don't run whole code in the loop, but recycle the graph:
      loop:
      WatchDog watchDog = new WatchDog(graph, runtimeContext);
      IThreadManager threadManager = new SimpleThreadManager();
      Future<Result> futureResult = threadManager.executeWatchDog(watchDog);

      Result result = Result.N_A;

      result = futureResult.get();

      graph.reset();
      :end_loop

    • don't use external library, i.e. set driver on the classpath, instead of in connection configuration:
      user=postgres
      jdbcSpecific=POSTGRE
      password=password
      name=name
      dbURL=jdbc\:postgresql\://localhost/dbname
      dbDriver=org.postgresql.Driver
      threadSafeConnection=true
  • Avatar
    jnderr
    0
    Comment actions Permalink
    Thank you for your help.

    Changing the connection.cfg to use the postgres driver in the class path worked great.

Please sign in to leave a comment.