A coworker asked me this. I gather he's trying to track down a memory
leak. Is is possible to override operator new (and delete) only within
a single file?
I beleive so, but it requires doing something very specific at
linking. I think, that if you have several .o/.obj files, and you use
a linker, it will take the order and any functions that exist to the
left will be used on the right.
It's been a while since I've even thought about this so bare with me.
ld -o a.out <some other options and libs> a.o new.o b.o <and some more
options and libs>
Now a.o will use the original new, and b.o should use the new located
in new.o.
I appologiese if this is not entirly correct. Check the ld man/info
page for more (possibly more accurate) info.
Adrian