Re: ATL OOM Resource leaks, and inconsistent behavior?



"=?Utf-8?B?TGVvbg==?=" <Leon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:9B781963-8624-4E1D-8F2B-9CF7D5E286D2@xxxxxxxxxxxxx:
> I am doing a release in the last part of the for loop.

Oh, so you are, sorry, I didn't read the code carefully enough, I
wasn't expecting the comma operator there.

> I changed the
> code as follows, and now I get a consistent crash on a not so big
> folder about half way through the appointments inside AtlComPtrAssign,
> probably when it's doing the assignment on GetNext or iAppt=NULL,
> where (*pp)->Release() crashes. Which means that the item is already
> freed or stepped on. Here is what the updated code looks like:

Just to eliminate one thing, are you sure that every object in that
folder is an appointment? I can't think of an obvious reason why it
would crash just on one item differently to all the other ones; maybe
every other time through you're getting lucky and the freed memory
hasn't been reused yet, but on that one item malloc et al happen to
shuffle stuff around and finally stomp on something that you're trying
to reuse.

As a different, more annoying, thing to try, what happens if you go
back to raw IDispatch everywhere? Heck, you could presumably go with
IUnknown everywhere, as long as Redemption'll take it -- that would let
you QI things as you go through just to make sure that they're
supporting the interfaces you expect.

You'd need to remember to release() stuff by hand, but it would at
least mean you'd know for certain what was going on, and hopefully that
might reveal what's going on enough that you can put the smart pointers
back in.

(heck, if you were feeling really brave, you could do all the dispatch
stuff by hand and call GetIDsOfNames/GetTypeInfo/etc, but I don't think
that would gain you much except for a bunch of pain. Then again, it
might be easy to copy the relevant bits of code out of the tlh/tli files
that #import has generated.)

Sorry I don't have anything more specific to suggest, but maybe this'll
shake out whatever's going on.

-- dan
.



Relevant Pages

  • RE: Incorrect Start Dates for Shared Recurring Appointments
    ... Incorrect Start Dates for Shared Recurring Appointments ... I have tested this information and it is still true for Outlook 2003. ... GetFolderFromID, the folder must be loaded within the profile and cannot be ... Dim Recip As Outlook.recipient ...
    (microsoft.public.office.developer.automation)
  • Incorrect Start Dates for Shared Recurring Appointments
    ... Startdate: The startdate from which to return appointments ... Dim MyItems ... It is even worse when the folderid is of a folder bellonging to another ...
    (microsoft.public.office.developer.automation)
  • Re: Using Delegates and WebDav
    ... If i change the URL to User1 then i can see the appointments. ... if you have access to the folder using Outlook Web Access, ... able to access those folder using WebDAV. ...
    (microsoft.public.exchange.development)
  • Re: Problems adding appointments to the calendar of a different user using web services
    ... when specifying the calendar folder as destination folder (element ... I am currently writing an application that adds appointments to the ... access the calendar folder of other users: I am always getting SOAP errors ... "Creating Appointments and meeting requests") in the Exchange Server 2007 ...
    (microsoft.public.exchange.development)
  • [SLE] Konqueror 3.1.3...back and forward buttons problem
    ... this guy is coll and *very* cheap!). ... Copied them all to a folder and rpm'd ... 'back' arrow or the 'forward' arrow on the main taskbar, ... and I then have to look at it to figure out where the heck ...
    (SuSE)