|
|
|
date: Wed, 21 Nov 2007 22:09:25 +0100,
group: microsoft.public.inetsdk.programming.urlmonikers
back
Re: PassthruAPPBeta.zip gives a memory leak when exiting.
Igor Tandetnik wrote:
> John wrote:
>> I am using PassthruAPPBeta.zip in my application (a variation of your
>> example testapp.cpp, that use threads to download files)
>>
>> It work fine except when I exit the program with 1 or more threads
>> still running. Then, it gives a memory leak. The threads use
>> InternetOpen( ) InternetReadFile( ), etc to download files
>
> What do you mean by "it gives a memory leak"? Who is "it"? What makes
> you believe there's a leak? Under exactly what circumstances?
>
> How exactly do you "use threads to download files"? Do you stop
> downloads in progress before exiting the application?
Hello,
1) By "memory leak" I mean that when I exit in this situation it apears
a message box like this:
--------- error message box ---------
The instruction at "0x702bc3bc" referenced memory at "0x00cba854". The
memory could not be "read"
Click on OK to terminate the program.
----------------------------------------------
"it" is the program that use PassthruAPPBeta toolkit.
2) The program is simular to your testapp.cpp (Internet Explorer
attached in a window) except that:
When CTestSink::OnResponse( ) found some URL I added some code
to starts a thread, to download that URL
The thread is created with CreateThread( ). The thread function uses
InternetOpen( ) InternetReadFile( ), etc to download a file.
I am sure that the code is correct, because I used in other applications
In this situation AND when the thread is still running (because download
still not completed), I exit the program, by clicking the close box.
Then I found the above message box.
I think I able to solve this, by exiting all the threads before closing
the application
and then wait some time (perpaps 10 seconds or so) before exiting.
However I would prefer solve the problem in PassthruAPPBeta.
Thanks in advance.
date: Wed, 21 Nov 2007 23:21:31 +0100
author: John
Re: PassthruAPPBeta.zip gives a memory leak when exiting.
John wrote:
> Igor Tandetnik wrote:
>> John wrote:
>>> I am using PassthruAPPBeta.zip in my application (a variation of
>>> your example testapp.cpp, that use threads to download files)
>>>
>>> It work fine except when I exit the program with 1 or more threads
>>> still running. Then, it gives a memory leak. The threads use
>>> InternetOpen( ) InternetReadFile( ), etc to download files
>>
>> What do you mean by "it gives a memory leak"? Who is "it"? What makes
>> you believe there's a leak? Under exactly what circumstances?
>>
>> How exactly do you "use threads to download files"? Do you stop
>> downloads in progress before exiting the application?
>
>
> Hello,
> 1) By "memory leak" I mean that when I exit in this situation it
> apears a message box like this:
>
> --------- error message box ---------
> The instruction at "0x702bc3bc" referenced memory at "0x00cba854". The
> memory could not be "read"
> Click on OK to terminate the program.
> ----------------------------------------------
That would be a crash, not a memory leak. A much more serious problem.
If you run under debugger, you should be given an opportunity to debug
the application at this point. Do that, look at the call stack, find
where the problem is.
> 2) The program is simular to your testapp.cpp (Internet Explorer
> attached in a window) except that:
>
> When CTestSink::OnResponse( ) found some URL I added some code
> to starts a thread, to download that URL
I don't understand. The URL is already being downloaded - that's why you
see it in the APP in the first place. Why do you need to download the
same URL again?
> The thread is created with CreateThread( ). The thread function uses
> InternetOpen( ) InternetReadFile( ), etc to download a file.
> I am sure that the code is correct, because I used in other
> applications
> In this situation AND when the thread is still running (because
> download still not completed), I exit the program, by clicking the
> close box. Then I found the above message box.
You should stop all requests and shut down all threads before exiting
the application.
> However I would prefer solve the problem in PassthruAPPBeta.
I'm not sure what makes you think the problem is in Passthrough APP code
rather than your code, but if you insist it's there, by all means go
ahead and solve it.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Wed, 21 Nov 2007 17:33:46 -0500
author: Igor Tandetnik
Re: PassthruAPPBeta.zip gives a memory leak when exiting.
When debugging apears the error at:
urlmon.ReleaseBindInfo when the program exits.
So this only apears when the programs exits
in that conditions, I finally solved the problem by adding
SetErrorMode( SEM_NOGPFAULTERRORBOX );
to avoid the error messages.
Thanks for the follow up.
Igor Tandetnik wrote:
> John wrote:
>> Igor Tandetnik wrote:
>>> John wrote:
>>>> I am using PassthruAPPBeta.zip in my application (a variation of
>>>> your example testapp.cpp, that use threads to download files)
>>>>
>>>> It work fine except when I exit the program with 1 or more threads
>>>> still running. Then, it gives a memory leak. The threads use
>>>> InternetOpen( ) InternetReadFile( ), etc to download files
>>> What do you mean by "it gives a memory leak"? Who is "it"? What makes
>>> you believe there's a leak? Under exactly what circumstances?
>>>
>>> How exactly do you "use threads to download files"? Do you stop
>>> downloads in progress before exiting the application?
>>
>> Hello,
>> 1) By "memory leak" I mean that when I exit in this situation it
>> apears a message box like this:
>>
>> --------- error message box ---------
>> The instruction at "0x702bc3bc" referenced memory at "0x00cba854". The
>> memory could not be "read"
>> Click on OK to terminate the program.
>> ----------------------------------------------
>
> That would be a crash, not a memory leak. A much more serious problem.
>
> If you run under debugger, you should be given an opportunity to debug
> the application at this point. Do that, look at the call stack, find
> where the problem is.
>
>> 2) The program is simular to your testapp.cpp (Internet Explorer
>> attached in a window) except that:
>>
>> When CTestSink::OnResponse( ) found some URL I added some code
>> to starts a thread, to download that URL
>
> I don't understand. The URL is already being downloaded - that's why you
> see it in the APP in the first place. Why do you need to download the
> same URL again?
>
>> The thread is created with CreateThread( ). The thread function uses
>> InternetOpen( ) InternetReadFile( ), etc to download a file.
>> I am sure that the code is correct, because I used in other
>> applications
>> In this situation AND when the thread is still running (because
>> download still not completed), I exit the program, by clicking the
>> close box. Then I found the above message box.
>
> You should stop all requests and shut down all threads before exiting
> the application.
>
>> However I would prefer solve the problem in PassthruAPPBeta.
>
> I'm not sure what makes you think the problem is in Passthrough APP code
> rather than your code, but if you insist it's there, by all means go
> ahead and solve it.
date: Fri, 23 Nov 2007 22:29:01 +0100
author: John
|
|