Hi, oh gurus! ;)
I am working in a big project written in C++, and I want to carefully
control the dynamically allocated/deallocated memory, since I am using a lot
of dynamic structures, and I suspect I have a memory leak somewhere.
What I want is to keep track of the quantity of allocated mem, and the
quantity of deallocated one, so I can inspect these values while running my
program.
I suposse that the best approach to acomplish this is overloading the
operators new and delete. But I have a problem here: I cannot call the
"global" default new from inside my overloaded new, even using the scope
(::) operator; every attempt to call the original new results in a annoying
recursive call to may own overloaded new, so I can't actually allocate
memory using this approach. On the other hand, if I use malloc, the program
crashes. I am using DJGPP 2.1 (GCC 2.7.0, I think).
What's wrong? Is this the best approach to 'filter' memory allocations?
Please, help me...
Thanks in advance to you all,
Juanje.
P.S.: Forgive any grammar incorrections: English is not my native Language.
... RANDOMIZE USR 0 :_)
--- Fastecho 1.45a+
---------------
* Origin: DECKARD BBS - (91) 643 10 67 - 24 Horas - 33600 V34+ (2:341/52)
|