Since upgrading from R5 to 6.5 most of our scheduled agents run out of memory. I read a few posts recommending that we use the Delete statement to free up memory, but none explain how to use it in detail.
Here is the code for one of my agents. Could someone please tell me where to use the delete statement and explain exactly what it will do to fix the issue.
Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim vw As notesview
Dim viewdoc As notesdocument
Set db=session.currentdatabase
Set vw=db.getview("CompletionInformation")
Set viewdoc=vw.getfirstdocument
Dim newdoc As NotesDocument
On Error Resume Next
Do Until viewdoc Is Nothing
'Create Response Document
Set newdoc = db.CreateDocument
Call newdoc.MakeResponse( viewdoc )
newdoc.Form = "CompletionInformation"
newdoc.RequestID = viewdoc.RequestID
newdoc.RequestDate = viewdoc.RequestDate
newdoc.ResponsiblePerson = viewdoc.ResponsiblePerson
newdoc.ResponsiblePerson2 = viewdoc.ResponsiblePerson2
newdoc.CellPhone = viewdoc.CellPhone
newdoc.CellPhone2 = viewdoc.CellPhone2
newdoc.TestPerson = viewdoc.TestPerson
newdoc.DateTested = viewdoc.DateTested
newdoc.QualityControl = viewdoc.QualityControl
newdoc.StartDate = viewdoc.StartDate
newdoc.EndDate = viewdoc.EndDate
newdoc.StartTime = viewdoc.StartTime
newdoc.EndTime = viewdoc.EndTime
newdoc.ChangeType = viewdoc.ChangeType
newdoc.RemoteChange = viewdoc.RemoteChange
newdoc.EffectedSystems = viewdoc.EffectedSystems
newdoc.ChangeLocation = viewdoc.ChangeLocation
newdoc.ServerName = viewdoc.ServerName
newdoc.EffectedLocations= viewdoc.EffectedLocations
newdoc.ServerDescription = viewdoc.ServerDescription
newdoc.ManagerOnSite = viewdoc.ManagerOnSite
newdoc.Priority = viewdoc.Priority
newdoc.PriorityDate= viewdoc.PriorityDate
newdoc.ManagedServiceProvider = viewdoc.ManagedServiceProvider
newdoc.ChangeDescription = viewdoc.ChangeDescription
newdoc.FallbackProcedures = viewdoc.FallbackProcedures
newdoc.AddComments = viewdoc.AddComments
Call newdoc.save(False,True)
'Added to refresh form
Call newdoc.ComputeWithForm(True,False)
Call newdoc.save(True,False)
'Send Email
Dim workspace As New NotesUIWorkspace
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc, "Body" )
doc.Subject = "Change Management Needs Completion Information"
’ doc.Principal = “STV Helpdesk/STV”
’ doc.ReplyTo = “STV Helpdesk/STV”
Call rtitem.AddNewLine( 1)
Call rtitem.AppendText( "The attached change management request needs completion information.")
Call rtitem.AddNewLine( 2)
Call rtitem.AppendText( "Select the link below to complete and submit this information immediately.")
Call rtitem.AddNewLine( 3 )
Call rtitem.AppendText( "Link to Change Completion Document ----->>>>>> " )
Call rtitem.AppendDocLink( newdoc, db.Title )
Call rtitem.AddNewLine( 3 )
Call rtitem.AppendText( "Thank you.")
Call doc.Send( False, newdoc.ResponsiblePerson)
'Mark original form that completion form was sent
viewdoc.CompletionFormSent="Yes"
Call viewdoc.save(True,False)
'Loop
Set viewdoc=vw.getnextdocument(viewdoc)
Loop
End Sub