none
Posting again: Memory leak in OL2010, when using Restrict with .IncludeRecurrences RRS feed

  • General discussion

  • Hi,

    I've posted this question few months ago, and I'd ask to raise it again.
    The thread I'm referring to is this one .

    I just ran into this issue again, and I would like to ask for your help.
    I would really appreciate if you can simply copy the code bellow into a new vbs file, run it on OL2010, and post bellow whether you see a memory leak in OL process or not.

    I've tried it on many machines, always got leak.
    For some reason it was not reproduced on MS environment, and I'm trying to get more inputs from more users.

    This is the code - simply copy paste it into a new text document, change it's extension to .vbs and run it.
    (The code simply finds meetings you have today in your calendar.
    It loops 100 times to magnify the memleak)

    call Test

    Const olFolderCalendar = 9

    sub Test

        Set objOutlook = CreateObject("Outlook.Application")
        Set objNamespace = objOutlook.GetNamespace("MAPI")
        Set objFolder = objNamespace.GetDefaultFolder(olFolderCalendar)

        d= DateValue(Now)

        '---------------------------------
        'Test Loop
        '---------------------------------  
        for i = 1 to 100

        dim myAppts

        strToday = "[Start] >= '" & d  & "' and [Start] <= '" & d  & " 11:59 pm'"
        set myappts = objFolder.Items
        myappts.sort "[Start]"

        myAppts.IncludeRecurrences = True
        myAppts.Sort "[Start]"
        Set myAppts = myappts.Restrict(strToday)


       Set myAppt = myAppts.GetFirst
       while not (myappt is nothing)
           dim s
           s = s & myappt.subject & ", " & myappt.start &  vbnewline
          'WScript.Sleep 1000
          Set myAppt = myAppts.Getnext
       wend
       next

        Set myAppt = nothing
        msgbox s

       set myAppts = Nothing
       set objFolder = Nothing
       set objNamespace = Nothing
       set objOutlook  = Nothing

    end sub

    As I said - please simply let me know if it resulted with memory leak or not.

    Thank you all
    Moshe

    Monday, September 3, 2012 6:27 PM

All replies