[Gc] SIGPWR

Fergus Henderson fjh@cs.mu.oz.au
Thu, 9 Oct 2003 11:27:06 +1000


On 07-Oct-2003, Giuseppe Attardi <attardi@di.unipi.it> wrote:
> I have no way to avoid redirect-malloc since
> allocation is done with strdup and new that do not
> expose a malloc() invocation.

You should be able to

	#define strdup(s) my_strdup(s)

and define your own global operator new and delete functions
(all 8 versions):

  void* operator new(std::size_t size) throw(std::bad_alloc);
  void* operator new(std::size_t size, const std::nothrow_t&) throw();
  void  operator delete(void* ptr) throw();
  void  operator delete(void* ptr, const std::nothrow_t&) throw();
  void* operator new[](std::size_t size) throw(std::bad_alloc);
  void* operator new[](std::size_t size, const std::nothrow_t&) throw();
  void  operator delete[](void* ptr) throw();
  void  operator delete[](void* ptr, const std::nothrow_t&) throw();

in terms of malloc() and free().

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.