Re: ATL OOM Resource leaks, and inconsistent behavior?
- From: Dan Mitchell <djmitchella@xxxxxxxxx>
- Date: Fri, 29 Apr 2005 12:56:39 -0700
"=?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
.
- Follow-Ups:
- References:
- ATL OOM Resource leaks, and inconsistent behavior?
- From: Leon
- Re: ATL OOM Resource leaks, and inconsistent behavior?
- From: Dan Mitchell
- Re: ATL OOM Resource leaks, and inconsistent behavior?
- From: Leon
- ATL OOM Resource leaks, and inconsistent behavior?
- Prev by Date: Re: ATL OOM Resource leaks, and inconsistent behavior?
- Next by Date: Re: ATL OOM Resource leaks, and inconsistent behavior?
- Previous by thread: Re: ATL OOM Resource leaks, and inconsistent behavior?
- Next by thread: Re: ATL OOM Resource leaks, and inconsistent behavior?
- Index(es):
Relevant Pages
|