RE: Can this cause memory leak ?
- From: "Mark" <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 21:35:01 -0700
No memory leak to worry about.
I will point out, it is inefficient and bad practice to catch exceptions
during the normal flow of your code. Adding a try/catch adds literally no
extra overhead but catching an exception is expensive, so your code should
only catch exceptions when an error is not normally expected.
Also, I always test for leaks (not just memory, handles, etc.) by opening
task manager and keeping an eye on mem usage, handles, threads, etc.
Mark.
"youhua.wang" wrote:
> We have a App ( WinCE x86 Application ), there are many try_catch handler
> like this:
>
> try
> {
> ...
> }
> catch (CException* pException)
> {
> ...
> pException->Delete();
> }
>
> And this work well. Now we transplant the App to WinCE ARM9 CPU platform,
> and the compiler complain that
> "catch (CException* pException) is not surport", so we replace it with
> catch(...), then the compiler go on.
>
> As a result, this time , we have exection handler like this:
>
> try
> {
> ...
> }
> //catch (CException* pException) //ARM9 CPU not surport this style
> catch( ... )
> {
> ...
> //pException->Delete(); // because no "pException" parameter
> }
>
> But I worry there is memory leak for lack the Delete() call.
> Is my worry unnecessary ?
>
> Any opnion are welcome!
>
> Thanks in Advance.
>
>
>
>
>
>
.
- References:
- Can this cause memory leak ?
- From: youhua.wang
- Can this cause memory leak ?
- Prev by Date: Can this cause memory leak ?
- Next by Date: Re: Can this cause memory leak ?
- Previous by thread: Can this cause memory leak ?
- Next by thread: Re: Can this cause memory leak ?
- Index(es):
Relevant Pages
|
Loading