4

I have seen several references to using .recycle to ensure you do not have memory issues with an xPage, however I am not sure how and where it should be used. I have checked the mastering xpages book, and have not found any specific reference to it. I suspect that this may be more obvious to those from a java background.

Should it be used when someone logs into the application, navigates between xpages? And what is this implication of use? Will it clear current sessions, or the sessionScope variables stored by a user? Is it user specific?

A

atom
  • 191
  • 2
  • 13

1 Answers1

7

The recycling is only required for domino java objects and is not a XPage-specific issue. You should recycle every domino object as soon you are not need it further, that's the golden rule.

Domino Objects are f.e. NotesSession, NotesDatabase, etc. They are accessed internally as C-Objects, and that is why it is important to "destroy" them manually. If you are accessing types of these objects in your code directly, you have to recycle them by yourself. XPages-specific objects like scoped variables are plain Java code and will be killed correctly by the Garbage collector.

For more details please have a look at this technote: Why it is important to use the Recycle() method on every Java object

Sven Hasselbach
  • 10,455
  • 1
  • 18
  • 26
  • 2
    Also have a look at the answer by Tim Tripcony to this similar question: http://stackoverflow.com/questions/11159444/what-is-the-best-way-to-recycle-domino-objects-in-java-beans – Per Henrik Lausten Aug 11 '12 at 18:15