Delete keyword

we are using below line of code in our Lotus script.

Doc1.Look1 = doc.Look1

Doc1.Look2 = doc.Look2

Call Doc1.Save(1,0,1)

Delete Doc1

I am not able to understand that why we are using delete doc1 .

it will delete the created document or some thing else.

Thanks

Subject: Delete keyword

Hi Kumar, The code u have sent will delete the documents.But if u tell cleraly in details whats your requiremewnt is ,i can help u .

Subject: RE: Delete keyword

No, it won’t.

Subject: Delete keyword

The Delete keyword does not delete the document from the database, it deletes the object reference in memory. The code you posted only shows a single example of a document object, so any memory management advantage you gain from deleting the reference is not readily apparent – but imagine a large loop that opens hundreds or thousands of documents. Even though you ase the same variable name to refer to the document each time through the loop, every one of those document objects will create its own “footprint” in memory that will continue to exist until the whole routine is finished running. Using Delete to free up the memory makes the code consume the least possible amount of memory.

Subject: RE: Delete keyword

Actually, in the more recent versions the memory management has improved, and you don’t get any performance advantage this way. You only have to use Delete if you have reason to believe that the cache is out of date and you need to reload it, for instance if you passed the note ID to an agent you are running, and you want to see what changes the agent made to the document.

Subject: RE: Delete keyword

Andre, where do we get more information on how memory management has changed and what the new practices in LotusScript should be? Are you talking about ND7 or ND8?

Our servers are all at 7.0.3, do we need to still use Delete?

Subject: RE: Delete keyword

That’s nice to know. Thanks, Andre.