Discussion Board
Overloading all new and delete operators
2007-06-08, 08:50
#1
Regular Contributor
Hi guys,
I am working on a small exercise to overload new and delete operator to keep track of what pointers are allocated and what are deleted.
I am able to overload one form of new operator .
TAny* operator new(TUint size )
I need your suggestion on this exercise.
I am planning to maintain a linked list of nodes containing what pointers are allocated with what size.
on every delete i will search that node by pointer address and remove from the list and also deallocate that pointer.
i am looking for your suggestions.
kinldy share your experience with me.
thanks and regards
nEo
Re: Overloading all new and delete operators
2007-06-08, 08:55
#2
Regular Contributor
oops !
i am getting error while overloading new(ELeave)
my function is
TAny* operator new(TUint size,TLeave aLeave);
the error as quoted from CodeWarrior IDE is
-----------------------------------------------------------------------
Error : object 'operator new(unsigned int, TLeave)' redefined
MAIN.cpp line 101
-----------------------------------------------------------------------
looking forward for your suggestioins.
regards
nEo'
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules