Re: memory leak?
- From: "Giovanni Dicanio" <giovanni.dicanio@xxxxxxxxxx>
- Date: Mon, 30 Jul 2007 12:39:59 +0200
"Dani" <anonymous@xxxxxxxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:uXXGN3c0HHA.5152@xxxxxxxxxxxxxxxxxxxxxxx
[...]
But do not assume that you have solved your problem, you should
investigate this memory leak deeply before you continue with writing your
program.
I completely agree.
Moreover, I wonder why the OP is using malloc/free (or even new/delete),
when he could instead use the more robust C++ container classes like
std::vector or MFC containers. If he wants to allocate an array of bytes to
store his video stream data, he could use std::vector<BYTE> or MFC container
CByteArray.
And, as Doug pointed in several of his previous posts in these newsgroups,
smart pointers like std::auto_ptr are good tools to fight against memory
leaks...
Moreover, frankly speaking, I don't like very much the use 'char' to
identify a 'byte'. IMHO, the code would be more readable and robust if an
explicit BYTE identifier is used, instead of 'char' (I don't know if the C++
standard states that a 'char' is an 8-bits byte... but I would always prefer
the explicit 'byte' specification instead of 'char'...).
Giovanni
.
- Follow-Ups:
- Re: memory leak?
- From: Doug Harrison [MVP]
- Re: memory leak?
- From: Joseph M . Newcomer
- Re: memory leak?
- References:
- memory leak?
- From: wanwan
- Re: memory leak?
- From: Joseph M . Newcomer
- Re: memory leak?
- From: Doug Harrison [MVP]
- Re: memory leak?
- From: wanwan
- Re: memory leak?
- From: Doug Harrison [MVP]
- Re: memory leak?
- From: wanwan
- Re: memory leak?
- From: Dani
- memory leak?
- Prev by Date: Re: Need help solving a threading issue
- Next by Date: Re: Print / Preview CWinFormsControl
- Previous by thread: Re: memory leak?
- Next by thread: Re: memory leak?
- Index(es):
Relevant Pages
|