oom doesnt free memory while looping through items collection.

J

John Smith

Hello,

oom 2002 doesnt free memory while i loop though items collection.


dim iItems as Outlook.Items
Dim iItems2 as outlook.Items
Dim iItem as Object
Dim newItem as Object

set iItems=......

for each iItem in iItems
set newItem = iItems2.Add("IPM.Appointmen.MyPM")
newItem.SomeProp = iItem.SomeProp
....
newItem.Save
set newItem=Nothing
next


While iterating throug iItems collection oom doesnt free memory and i end
up with windows running out of sysres.
Are there any warkarounds for this problem?

Thanks!
 
K

Ken Slovak - [MVP - Outlook]

That is a known bug in Outlook memory management. Aside from
increasing the Windows virtual memory available on the computer you
can use CDO 1.21 code or Redemption code (www.dimastr.com/redemption)
to work with an object model that has fewer memory leaks.

If you are using the Outlook object model you can restrict the Items
collection to make it smaller and you can use SetColumns to set the
fields you will work with to reduce the memory footprint of the
collection. Both also will speed up your code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top