Group:  Microsoft Outlook » microsoft.public.outlook.program_addins
Thread: Outlook Object Model Threading

Geek News

Outlook Object Model Threading
MON205 4/24/2007 2:32:04 PM
Hello all,
after months of working in an addin for outlook using OOM, I found a big
problem which is that OOM is not multithreaded as discussed in: http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8 http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7

Problems started with multithreaded as I described in an earlier question http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1

and then I found that the problem is threading problem.
Now I used marshaling in my threads, threading now is acceptable, but a one
problem found, which is when I call the SaveAs() method of the MailItem, the
mouse cursor changed to busy. I don't want this scenario... can I prevent
it?!!
It is possible to move to other technologies like MAPI, but how can I save
mails?!!

Please help...
Re: Outlook Object Model Threading
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 4/24/2007 6:55:55 PM
Yes, you can use MAPI to do that:
http://support.microsoft.com/kb/171907

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
[Quoted Text]
> Hello all,
> after months of working in an addin for outlook using OOM, I found a big
> problem which is that OOM is not multithreaded as discussed in:
> http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
> http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
>
> Problems started with multithreaded as I described in an earlier question
> http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
>
> and then I found that the problem is threading problem.
> Now I used marshaling in my threads, threading now is acceptable, but a
> one
> problem found, which is when I call the SaveAs() method of the MailItem,
> the
> mouse cursor changed to busy. I don't want this scenario... can I prevent
> it?!!
> It is possible to move to other technologies like MAPI, but how can I save
> mails?!!
>
> Please help...


Re: Outlook Object Model Threading
MON205 4/25/2007 6:36:01 AM
Oh...
Thanks a lot for fast response...
Now, if I pass a message interface to a thread to save it, is this a thread
safe?!!
Thanks again.

"Dmitry Streblechenko" wrote:

[Quoted Text]
> Yes, you can use MAPI to do that:
> http://support.microsoft.com/kb/171907
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
> > Hello all,
> > after months of working in an addin for outlook using OOM, I found a big
> > problem which is that OOM is not multithreaded as discussed in:
> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
> >
> > Problems started with multithreaded as I described in an earlier question
> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
> >
> > and then I found that the problem is threading problem.
> > Now I used marshaling in my threads, threading now is acceptable, but a
> > one
> > problem found, which is when I call the SaveAs() method of the MailItem,
> > the
> > mouse cursor changed to busy. I don't want this scenario... can I prevent
> > it?!!
> > It is possible to move to other technologies like MAPI, but how can I save
> > mails?!!
> >
> > Please help...
>
>
>
Re: Outlook Object Model Threading
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 4/25/2007 4:59:53 PM
I'd rather open the message on the secondary thread.
I also have a feeling that spawning a secondary thread just to save a single
message will actually make the performance worse.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
[Quoted Text]
> Oh...
> Thanks a lot for fast response...
> Now, if I pass a message interface to a thread to save it, is this a
> thread
> safe?!!
> Thanks again.
>
> "Dmitry Streblechenko" wrote:
>
>> Yes, you can use MAPI to do that:
>> http://support.microsoft.com/kb/171907
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
>> > Hello all,
>> > after months of working in an addin for outlook using OOM, I found a
>> > big
>> > problem which is that OOM is not multithreaded as discussed in:
>> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
>> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
>> >
>> > Problems started with multithreaded as I described in an earlier
>> > question
>> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
>> >
>> > and then I found that the problem is threading problem.
>> > Now I used marshaling in my threads, threading now is acceptable, but a
>> > one
>> > problem found, which is when I call the SaveAs() method of the
>> > MailItem,
>> > the
>> > mouse cursor changed to busy. I don't want this scenario... can I
>> > prevent
>> > it?!!
>> > It is possible to move to other technologies like MAPI, but how can I
>> > save
>> > mails?!!
>> >
>> > Please help...
>>
>>
>>


Re: Outlook Object Model Threading
MON205 4/26/2007 6:40:01 AM
I'll take this in consideration.
Thanks a lot.

"Dmitry Streblechenko" wrote:

[Quoted Text]
> I'd rather open the message on the secondary thread.
> I also have a feeling that spawning a secondary thread just to save a single
> message will actually make the performance worse.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
> > Oh...
> > Thanks a lot for fast response...
> > Now, if I pass a message interface to a thread to save it, is this a
> > thread
> > safe?!!
> > Thanks again.
> >
> > "Dmitry Streblechenko" wrote:
> >
> >> Yes, you can use MAPI to do that:
> >> http://support.microsoft.com/kb/171907
> >>
> >> Dmitry Streblechenko (MVP)
> >> http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
> >>
> >> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> >> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
> >> > Hello all,
> >> > after months of working in an addin for outlook using OOM, I found a
> >> > big
> >> > problem which is that OOM is not multithreaded as discussed in:
> >> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
> >> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
> >> >
> >> > Problems started with multithreaded as I described in an earlier
> >> > question
> >> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
> >> >
> >> > and then I found that the problem is threading problem.
> >> > Now I used marshaling in my threads, threading now is acceptable, but a
> >> > one
> >> > problem found, which is when I call the SaveAs() method of the
> >> > MailItem,
> >> > the
> >> > mouse cursor changed to busy. I don't want this scenario... can I
> >> > prevent
> >> > it?!!
> >> > It is possible to move to other technologies like MAPI, but how can I
> >> > save
> >> > mails?!!
> >> >
> >> > Please help...
> >>
> >>
> >>
>
>
>
Re: Outlook Object Model Threading
MON205 5/3/2007 12:46:01 PM
Hello,
I found that the scenario in the Microsoft link:
http://support.microsoft.com/kb/171907
leads into memory leak!!!!!!
What is the problem?!!!

"MON205" wrote:

[Quoted Text]
> I'll take this in consideration.
> Thanks a lot.
>
> "Dmitry Streblechenko" wrote:
>
> > I'd rather open the message on the secondary thread.
> > I also have a feeling that spawning a secondary thread just to save a single
> > message will actually make the performance worse.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> > "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> > news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
> > > Oh...
> > > Thanks a lot for fast response...
> > > Now, if I pass a message interface to a thread to save it, is this a
> > > thread
> > > safe?!!
> > > Thanks again.
> > >
> > > "Dmitry Streblechenko" wrote:
> > >
> > >> Yes, you can use MAPI to do that:
> > >> http://support.microsoft.com/kb/171907
> > >>
> > >> Dmitry Streblechenko (MVP)
> > >> http://www.dimastr.com/
> > >> OutlookSpy - Outlook, CDO
> > >> and MAPI Developer Tool
> > >>
> > >> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> > >> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
> > >> > Hello all,
> > >> > after months of working in an addin for outlook using OOM, I found a
> > >> > big
> > >> > problem which is that OOM is not multithreaded as discussed in:
> > >> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
> > >> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
> > >> >
> > >> > Problems started with multithreaded as I described in an earlier
> > >> > question
> > >> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
> > >> >
> > >> > and then I found that the problem is threading problem.
> > >> > Now I used marshaling in my threads, threading now is acceptable, but a
> > >> > one
> > >> > problem found, which is when I call the SaveAs() method of the
> > >> > MailItem,
> > >> > the
> > >> > mouse cursor changed to busy. I don't want this scenario... can I
> > >> > prevent
> > >> > it?!!
> > >> > It is possible to move to other technologies like MAPI, but how can I
> > >> > save
> > >> > mails?!!
> > >> >
> > >> > Please help...
> > >>
> > >>
> > >>
> >
> >
> >
Re: Outlook Object Model Threading
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 5/3/2007 5:03:16 PM
And how does the memory leak manifest itself?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
news:DB90C854-84BC-437F-8B89-36BCEC2E0BCD[ at ]microsoft.com...
[Quoted Text]
> Hello,
> I found that the scenario in the Microsoft link:
> http://support.microsoft.com/kb/171907
> leads into memory leak!!!!!!
> What is the problem?!!!
>
> "MON205" wrote:
>
>> I'll take this in consideration.
>> Thanks a lot.
>>
>> "Dmitry Streblechenko" wrote:
>>
>> > I'd rather open the message on the secondary thread.
>> > I also have a feeling that spawning a secondary thread just to save a
>> > single
>> > message will actually make the performance worse.
>> >
>> > Dmitry Streblechenko (MVP)
>> > http://www.dimastr.com/
>> > OutlookSpy - Outlook, CDO
>> > and MAPI Developer Tool
>> >
>> > "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> > news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
>> > > Oh...
>> > > Thanks a lot for fast response...
>> > > Now, if I pass a message interface to a thread to save it, is this a
>> > > thread
>> > > safe?!!
>> > > Thanks again.
>> > >
>> > > "Dmitry Streblechenko" wrote:
>> > >
>> > >> Yes, you can use MAPI to do that:
>> > >> http://support.microsoft.com/kb/171907
>> > >>
>> > >> Dmitry Streblechenko (MVP)
>> > >> http://www.dimastr.com/
>> > >> OutlookSpy - Outlook, CDO
>> > >> and MAPI Developer Tool
>> > >>
>> > >> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> > >> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
>> > >> > Hello all,
>> > >> > after months of working in an addin for outlook using OOM, I found
>> > >> > a
>> > >> > big
>> > >> > problem which is that OOM is not multithreaded as discussed in:
>> > >> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
>> > >> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
>> > >> >
>> > >> > Problems started with multithreaded as I described in an earlier
>> > >> > question
>> > >> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
>> > >> >
>> > >> > and then I found that the problem is threading problem.
>> > >> > Now I used marshaling in my threads, threading now is acceptable,
>> > >> > but a
>> > >> > one
>> > >> > problem found, which is when I call the SaveAs() method of the
>> > >> > MailItem,
>> > >> > the
>> > >> > mouse cursor changed to busy. I don't want this scenario... can I
>> > >> > prevent
>> > >> > it?!!
>> > >> > It is possible to move to other technologies like MAPI, but how
>> > >> > can I
>> > >> > save
>> > >> > mails?!!
>> > >> >
>> > >> > Please help...
>> > >>
>> > >>
>> > >>
>> >
>> >
>> >


Re: Outlook Object Model Threading
MON205 5/6/2007 7:44:02 AM
From the Windows Task Manager \ Processes \ Outlook:
When I enter the SaveToMsg() function – Mem Usage = 31,592 KB, and number of
handles 587.
When returning from the function, Mem Usage = 31,672 KB, Handles = 594.
Note that this increase in memory is not fixed and I think that it depends
on the Mail Size. Imaging what will happen when saving 10,000 mail or more!!!
In the following table (it will not shown as a table here!!!), I wrote the
values of memory and handles after each call in the SaveToMag().

Time Mem Usage (KB) No. of Handles
----------------------------------------------------------------------

When enter the SaveToMsg 31,592 587
After StgCreateDocfile 31,616 594
After OpenIMsgSession No Change No Change
After OpenIMsgOnIStg 31,624 No Change
After WriteClassStg No Change No Change
After CopyTo 31,848 595
After SaveChanges 31,960 594
After Commit 31,968 No Change
After pStorage->Release No Change No Change
After pIMsg->Release 31,672 No Change
After CloseIMsgSession No Change No Change
After{
pStorage = NULL;
pIMsg = NULL;
pMsgSession = NULL;} No Change No Change
-------------------------------------------------------------------------
I hope someone can help on this.



-------------------------------------
"Dmitry Streblechenko" wrote:

[Quoted Text]
> And how does the memory leak manifest itself?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> news:DB90C854-84BC-437F-8B89-36BCEC2E0BCD[ at ]microsoft.com...
> > Hello,
> > I found that the scenario in the Microsoft link:
> > http://support.microsoft.com/kb/171907
> > leads into memory leak!!!!!!
> > What is the problem?!!!
> >
> > "MON205" wrote:
> >
> >> I'll take this in consideration.
> >> Thanks a lot.
> >>
> >> "Dmitry Streblechenko" wrote:
> >>
> >> > I'd rather open the message on the secondary thread.
> >> > I also have a feeling that spawning a secondary thread just to save a
> >> > single
> >> > message will actually make the performance worse.
> >> >
> >> > Dmitry Streblechenko (MVP)
> >> > http://www.dimastr.com/
> >> > OutlookSpy - Outlook, CDO
> >> > and MAPI Developer Tool
> >> >
> >> > "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> >> > news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
> >> > > Oh...
> >> > > Thanks a lot for fast response...
> >> > > Now, if I pass a message interface to a thread to save it, is this a
> >> > > thread
> >> > > safe?!!
> >> > > Thanks again.
> >> > >
> >> > > "Dmitry Streblechenko" wrote:
> >> > >
> >> > >> Yes, you can use MAPI to do that:
> >> > >> http://support.microsoft.com/kb/171907
> >> > >>
> >> > >> Dmitry Streblechenko (MVP)
> >> > >> http://www.dimastr.com/
> >> > >> OutlookSpy - Outlook, CDO
> >> > >> and MAPI Developer Tool
> >> > >>
> >> > >> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
> >> > >> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
> >> > >> > Hello all,
> >> > >> > after months of working in an addin for outlook using OOM, I found
> >> > >> > a
> >> > >> > big
> >> > >> > problem which is that OOM is not multithreaded as discussed in:
> >> > >> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
> >> > >> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
> >> > >> >
> >> > >> > Problems started with multithreaded as I described in an earlier
> >> > >> > question
> >> > >> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
> >> > >> >
> >> > >> > and then I found that the problem is threading problem.
> >> > >> > Now I used marshaling in my threads, threading now is acceptable,
> >> > >> > but a
> >> > >> > one
> >> > >> > problem found, which is when I call the SaveAs() method of the
> >> > >> > MailItem,
> >> > >> > the
> >> > >> > mouse cursor changed to busy. I don't want this scenario... can I
> >> > >> > prevent
> >> > >> > it?!!
> >> > >> > It is possible to move to other technologies like MAPI, but how
> >> > >> > can I
> >> > >> > save
> >> > >> > mails?!!
> >> > >> >
> >> > >> > Please help...
> >> > >>
> >> > >>
> >> > >>
> >> >
> >> >
> >> >
>
>
>
Re: Outlook Object Model Threading
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 5/6/2007 3:37:49 PM
MAPI has its own memory subsystem; so saving a single message won't tell you
much.
Try to save multiple (hundreds?) messages and see if you can spot any
problem.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
news:913ED8BC-3FA9-4F6D-B6A3-30648EAD2B4E[ at ]microsoft.com...
[Quoted Text]
> From the Windows Task Manager \ Processes \ Outlook:
> When I enter the SaveToMsg() function - Mem Usage = 31,592 KB, and number
> of
> handles 587.
> When returning from the function, Mem Usage = 31,672 KB, Handles = 594.
> Note that this increase in memory is not fixed and I think that it depends
> on the Mail Size. Imaging what will happen when saving 10,000 mail or
> more!!!
> In the following table (it will not shown as a table here!!!), I wrote the
> values of memory and handles after each call in the SaveToMag().
>
> Time Mem Usage (KB) No. of
> Handles
> ----------------------------------------------------------------------
>
> When enter the SaveToMsg 31,592 587
> After StgCreateDocfile 31,616 594
> After OpenIMsgSession No Change No Change
> After OpenIMsgOnIStg 31,624 No Change
> After WriteClassStg No Change No Change
> After CopyTo 31,848 595
> After SaveChanges 31,960 594
> After Commit 31,968 No
> Change
> After pStorage->Release No Change No Change
> After pIMsg->Release 31,672 No Change
> After CloseIMsgSession No Change No Change
> After{
> pStorage = NULL;
> pIMsg = NULL;
> pMsgSession = NULL;} No Change No Change
> -------------------------------------------------------------------------
> I hope someone can help on this.
>
>
>
> -------------------------------------
> "Dmitry Streblechenko" wrote:
>
>> And how does the memory leak manifest itself?
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> news:DB90C854-84BC-437F-8B89-36BCEC2E0BCD[ at ]microsoft.com...
>> > Hello,
>> > I found that the scenario in the Microsoft link:
>> > http://support.microsoft.com/kb/171907
>> > leads into memory leak!!!!!!
>> > What is the problem?!!!
>> >
>> > "MON205" wrote:
>> >
>> >> I'll take this in consideration.
>> >> Thanks a lot.
>> >>
>> >> "Dmitry Streblechenko" wrote:
>> >>
>> >> > I'd rather open the message on the secondary thread.
>> >> > I also have a feeling that spawning a secondary thread just to save
>> >> > a
>> >> > single
>> >> > message will actually make the performance worse.
>> >> >
>> >> > Dmitry Streblechenko (MVP)
>> >> > http://www.dimastr.com/
>> >> > OutlookSpy - Outlook, CDO
>> >> > and MAPI Developer Tool
>> >> >
>> >> > "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> >> > news:DCA39D61-11C5-435D-84D9-6EF14449DA4C[ at ]microsoft.com...
>> >> > > Oh...
>> >> > > Thanks a lot for fast response...
>> >> > > Now, if I pass a message interface to a thread to save it, is this
>> >> > > a
>> >> > > thread
>> >> > > safe?!!
>> >> > > Thanks again.
>> >> > >
>> >> > > "Dmitry Streblechenko" wrote:
>> >> > >
>> >> > >> Yes, you can use MAPI to do that:
>> >> > >> http://support.microsoft.com/kb/171907
>> >> > >>
>> >> > >> Dmitry Streblechenko (MVP)
>> >> > >> http://www.dimastr.com/
>> >> > >> OutlookSpy - Outlook, CDO
>> >> > >> and MAPI Developer Tool
>> >> > >>
>> >> > >> "MON205" <MON205[ at ]discussions.microsoft.com> wrote in message
>> >> > >> news:CC92C0EA-03EA-4D90-8EB8-1585F507103D[ at ]microsoft.com...
>> >> > >> > Hello all,
>> >> > >> > after months of working in an addin for outlook using OOM, I
>> >> > >> > found
>> >> > >> > a
>> >> > >> > big
>> >> > >> > problem which is that OOM is not multithreaded as discussed in:
>> >> > >> > http://groups.google.jo/group/microsoft.public.outlook.program_addins/browse_thread/thread/3b5bca8446787d33/0a3609c5934618a8?lnk=st&q=oom+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
>> >> > >> > http://groups.google.jo/group/microsoft.public.developer.outlook.addins/browse_thread/thread/3984df29384d8816/0cd9ee67eed9d3c7?lnk=st&q=oom+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7
>> >> > >> >
>> >> > >> > Problems started with multithreaded as I described in an
>> >> > >> > earlier
>> >> > >> > question
>> >> > >> > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.outlook.program_addins&tid=862b6119-97e1-4fe1-b867-fc26dbc0b2b5&cat=en_us_7d8c5004-1d0a-4e14-a6a2-3d04905df293&lang=en&cr=us&p=1
>> >> > >> >
>> >> > >> > and then I found that the problem is threading problem.
>> >> > >> > Now I used marshaling in my threads, threading now is
>> >> > >> > acceptable,
>> >> > >> > but a
>> >> > >> > one
>> >> > >> > problem found, which is when I call the SaveAs() method of the
>> >> > >> > MailItem,
>> >> > >> > the
>> >> > >> > mouse cursor changed to busy. I don't want this scenario... can
>> >> > >> > I
>> >> > >> > prevent
>> >> > >> > it?!!
>> >> > >> > It is possible to move to other technologies like MAPI, but how
>> >> > >> > can I
>> >> > >> > save
>> >> > >> > mails?!!
>> >> > >> >
>> >> > >> > Please help...
>> >> > >>
>> >> > >>
>> >> > >>
>> >> >
>> >> >
>> >> >
>>
>>
>>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net