Memory leak depate. Linux vs windows vs another?

Started by
11 comments, last by Shannon Barber 18 years, 3 months ago
Windows allows you to detect these kinds of things using structured exception handling.

tj963
tj963
Advertisement
accessing memory that is not yours happens in a buffer overflow. and possibly in funky pointer arithmetic.
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

A memory leak occurs when you allocate memory and do not free it, as demonstrated by Libvan's buggy code.

A "memory read overrun" or "memory write overrun" occurs when you read/write memory outside of the program structure's intent. (This is what you've been talking about.) The OS kernel should only check to the granuality of the page-size (typically 4k) if it has an MMU. Without an MMI it will not perform any checking at all (most embedded devices do not have an MMU).

Under Windows using C you should be able use SEH (structured exception handling) to catch this exception (these exceptions are translated to the int type for C++ exception handling. e.g. catch(int err){} ). I'm not certain if/how the exception is delivered under Linux, probably a signal for both C & C++.

There's a tool called BoundsChecker which is part of DevPartner made by CompuWare for MSVC that will dynamically (at run-time) detect memory overruns in your code (among other many other problems such as leaks).
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement