JBoss Community

Spring integration, memory leaks

created by Daniel Murygin in jBPM Development - View the full discussion

I noticed a memory leak in jBPM Spring integration while profiling my application.

I'm using jBPM 4.4 and Spring 2.5.6.

 

jBPM calls org.jbpm.pvm.internal.env.SpringContext.get(Class<T> type) to retrieve Spring beans. This method calls org.springframework.context.ApplicationContext.getBeanNamesForType(type) everytime to get the bean anme for the class. These calls causes 30 MB memory usage after short runtime with only one user.

 

Nebeans Profiler snapshot:

https://dl.dropbox.com/u/342869/SpringContext.png

 

Since getBeanNamesForType(type) reads names from the static Spring configuration SpringContext.get should cache the names after reading. I added a simple static Hashmap to SpringContext which saved 25 MB ram.

 

I added a patch for maven module pvm of the jBPM-4.4 sources. A more sophisticated cache solution may be required in other environment with multiple Spring ApplicationContexts in one JVM.

 

- Daniel

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community