I have a complicated Java agent that calls dozens of classes. Do I need to recycle Domino objects? I’ve gotten so much contradictory information on this subject.
This article implies that recycle is not neededed:
http://www-1.ibm.com/support/docview.wss?rs=203&uid=swg21097861&loc=en_US&cs=utf-8&lang=en
“When using objects in an Agent all objects (both Java and C++) are destroyed when the agent ends.”
So why do I need to use recycle?
Can I just recycle the session object? Theoretically, recycling the session should recycle all the child objects (documents, databaes, etc…). I’ve heard that this is not the case.
Subject: recycle is needed. No it’s not. Yes it is. No it’s not…etc…
You need recycle if you want to free memory BEFORE the agent ends.
You don’t need recycle if the agent does not use a lot of memory (it does not matter if it is complicated, it only matters if it is a memory hog). By default the clean up happens only when the agent ends.
So if you runnning a lot of hog agents in an environment like the web where the same agent can run on many different threads at the same time, it is a good practice to recycle when you no longer need an object rather than waiting until the end so your entire environment operates in the most effecient manner.