A year ago or so I presented an idea to prevent ROT overgrowth which was killing my application. Now I have a better solution to this. What do you think about the following approach:
1. Divide jacob objects to "keeped" and "temporary objects". All are temporary except ones marked using the JacobObject.keep(true) method. So every object jacob creates behind the scene is temporary.
2. Implement ComThread.clearTempObjects() method to get rid of all temporary objects.
So when I use excel I first do:
excel.keep(), workbook.keep(), sh.keep()
Then for every completed row I call ComThread.clearTempObjects(). Rot contains only these several objects that must stay in memory.
I attach the patch to review. The patch may need some refining and even may not fit the newest jacob, because I prepared it for 1.15M3. But if you buy the idea I can work on it further.