andrew clarke wrote:
> While not strictly related to C or C++ programming, I thought I'd ask
> about this here...
> 
> When I began writing this e-mail, I was going to ask what this type of
> bug would be classified as, but after reading what I've written, and
> based on a few assumptions, I suppose it was just a type of memory leak.

Yup.  But "resource leak" is probably a better term.


> Back in the DOS days a memory leak could have severe consequences,
> particularly if programs were not designed to detect them.  Although,
> perhaps these days you could still have a serious problem if you wrote a
> Windows or Linux driver that leaked memory if its API was misused by an
> application.  Maybe the trick is to have the application allocate the
> memory instead.  But there are probably times where that isn't
> practical.  Maybe this type of bug is more common than I think?

If you aren't using Safe C++ (at least the Design Principles part - some 
people like STL - crazy people), then, yup, that's a pretty common bug. 
  Safe C++ cleans up after itself - sort of like garbage collection but 
implicitly embedded into the code itself.  You can count on one hand 
(maybe two hands) how many new/delete statements are in your code.  API 
calls are able to be paired off so that memory leaks are next to impossible.

Also, there are tools nowadays that can detect memory leaks...not just 
new/delete but resource leaks like file handles, registry keys, etc. 
Kids these days have it so easy.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* VerifyMyPC 2.1
Change tracking and management tool.
Reduce tech. support times from 2 hours to 5 minutes.

Free for personal use, $10 otherwise.
http://www.CubicleSoft.com/VerifyMyPC/

Reply via email to