From: Giacomo P. <gia...@gm...> - 2015-07-29 13:03:50
|
Hi everybody, I found a memory leak caused by a misuse of the DefaultHapiContext. To keep it short, we were creating many different DefaultHapiContext using the default constructor: HapiContext ctx = new DefaultHapiContext(); This caused a memory leak! The instances of DefaultHapiContext are not collected by the garbage collector since they are referenced by the ApplicationShutdownHook! I found that when calling new DefaultHapiContext(), HAPI creates a default ExecutorService which is then registered to the shutdown hook. This happens when the getExecutorService() is called. I don't know if this needs to get fixed (in the code or in the javadoc), but at least I wanted to share with you this problem. We solved the problem passing a custom ExecutorService to the DefaultHapiContext constructor. |