Skip to Content
0
Former Member
Jul 27, 2006 at 02:48 PM

when and how many times do i have to call the garbage collector ?

36 Views

hi,

how often do i have to delete my objects ? Do i have to delete the objects within my sub like as follows or is it ok when i delete all object when my addon will exit?


private sub x()

        Dim oRec As SAPbobsCOM.Recordset
        oRec = moSBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

...

'delete objects
      System.Runtime.InteropServices.Marshal.ReleaseComObject(oRec)
        oRec = Nothing
        GC.Collect() 'Call the garbage collector for good measure
        GC.WaitForPendingFinalizers()

end sub

thanks

Markus