Subject: It may be that this message is actually caused by your exceeding the limit of the maximum number of memory segments
In which case, you might look at how much memory your script is allocating, and in particular whether there are a lot of NotesXxx objects in memory – NotesDocument, NotesView, NotesItem, and so on – before the point at which you try to open a view and finally run out.