TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JUAN ALCOLEA
from: DANNY SPRINGER
date: 1997-08-30 22:37:00
subject: Overloading NEW & DELETE: Help! :_(

Hi Juan,
In a message of  to All (), you wrote:
 JA> Hi, oh gurus! ;)
 JA>     I am working in a big project written in C++, and I want to 
arefully
 JA> control the dynamically allocated/deallocated memory, since I am using a
 JA> lot of dynamic structures, and I suspect I have a memory leak somewhere.
 JA> What I want is to keep track of the quantity of allocated mem, and the
 JA> quantity of deallocated one, so I can inspect these values while running
 JA> my program.
What I do with these kind of problems is checking the heap on lots of places:
#define _HEAPCHECK_ON           <=== include this to switch it on
#ifdef _HEAPCHECK_ON
#include 
#include 
#endif
// Repeat these lines everywhere you want to check
#ifdef _HEAPCHECK_ON
assert(heapcheck() != _HEAPCORRUPT);
#endif
I start in main, and when I find out in which function the problem appears, I 
repeat these steps in that function. Still it can be hard to find out exactly 
where (and why!!!) it happens.
Regards,
Danny Springer.
(dsp@bitbike.com)
---
---------------
* Origin: Punt 12 uit Den Haag [NL] Point of AINEX (2:282/123.12@fidonet)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.