Outlook Object Model Threading

G

Guest

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/micro...+thread+marshal&rnum=1&hl=en#0a3609c5934618a8
http://groups.google.jo/group/micro...+thread+marshal&rnum=3&hl=en#0cd9ee67eed9d3c7

Problems started with multithreaded as I described in an earlier question
http://www.microsoft.com/communitie...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...
 
G

Guest

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.
 
D

Dmitry Streblechenko

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
 
G

Guest

I'll take this in consideration.
Thanks a lot.

Dmitry Streblechenko said:
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
 
G

Guest

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.



-------------------------------------
 
D

Dmitry Streblechenko

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
 

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