View Single Post
  #2  
Old October 23rd 09, 09:49 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default active inspector in memory

I'm not sure if this is what you're talking about, or even what version of
Outlook you're using or what language, but Outlook caches items and releases
them when it feels like it. You can't force a release of an item from the
cache, in fact except in Outlook 2007 you can't even detect from Outlook
when the item is released.

There is a method in 2007 that tells you that, the item.Unload() event.

Using managed code (VB.NET or C#) can also contribute to that since even
setting an item to null won't release it fully until the RCW is destroyed
and the garbage collector runs on the item. You can help accelerate that by
calling Marshal.ReleaseComObject() on the item until the function returns 0,
then calling GC.Collect().

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ashish" wrote in message
...
When open a mail acive inspector comes in picture (i set all events for
active inspector), get current item (mail item, set all events for mail
item) from acive inspector, modify it and save it.
When close mail free all events for mail item and active inspector and set
them null. But i found active inspector and its current item still remain
in memory until i change the selection in active explorer (after closing
mail select another mail in active explorer). It means outlook keeps
active inspector in memory until we change any other mail. How to free
active inspector from memory without changing selection.


Ads