Mail Archives: djgpp/1997/10/18/03:02:33
Alex Baldin wrote:
> Is there in DJGPP some like `coreleft' in Borland C ? If not, how
> can I detect memory leaks in my program?
Using library calls to check how much memory is left often is not
helpful, because 1. it is nonportable and 2. in some memory models,
memory freed by a process is not actually released until the program
exits. In the latter case, the "coreleft" (or equivalent) function will
not give you the right answer.
The safest, most portable, and easiest-to-control way is to make
wrappers around malloc/free or new/delete, so that you can monitor what
is being allocated and freed. And in that case, all you need to do is
periodically check if there are any unaccounted-for outstanding
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://newton.alcyone.com/
San Jose, California, United States / icbm://+37.20.07/-121.53.38
"After each war there is a little / less democracy to save."
/ Brooks Atkinson
- Raw text -