O
Office Drone
I already figured out how to replace new & delete operators, which
wasn't that hard and this is working great globally.
However, aside from new & delete, memory allocation is also used via
calling malloc/calloc & free functions.
What is the proper way to override these functions globally, not from
inside the class?
When I simply replace it like:
file: mysrcfile.c
----------------------------------------------
void free( void *memblock ) {
static fGuard = 0;
if( !fGuard )
{
fGuard = 1;
printf("free: block count=%i\n", --nMemBlocks);
fGuard = 0;
}
::free( memblock );
}
wasn't that hard and this is working great globally.
However, aside from new & delete, memory allocation is also used via
calling malloc/calloc & free functions.
What is the proper way to override these functions globally, not from
inside the class?
When I simply replace it like:
file: mysrcfile.c
----------------------------------------------
void free( void *memblock ) {
static fGuard = 0;
if( !fGuard )
{
fGuard = 1;
printf("free: block count=%i\n", --nMemBlocks);
fGuard = 0;
}
::free( memblock );
}