I have two large EJBs (2800+ lines of code each one) which contains methods used during different stages of a large process, while executing that process the application server falls in memory leaks when it starts eating a lot of memory and the gc doesn't release it.
I have checked some possible causes like large lists, maps and objects and I've fixed some of them, however I'd like to know if splitting those EJBs in many EJBs with the methods specialized in each part of the process will help to decrease the memory consumption.
Thanks in advance.
Both EJBs are stateless and have some instance variables attributes with references to other Stateless EJBs and resources.
A large source file wouldn't cause a memory leak, but it'd be a nightmare trying to debug it. You should refactor it just so it's easier to fix.