C++ allocation in arena ?

New Message Reply Date view Thread view Subject view Author view

Simon Hayhurst (simon++at++nirvana.neu.sgi.com)
Mon, 11 Sep 1995 12:20:41 -0600


On Sep 11, 9:10am, Lionel Maiaux wrote:
> Subject: C++ allocation in arena ?
> Hi,
>
> I want to use standard C++ allocation (new, delete) but I want these
> allocations to be in Performer arena.
> I suppose it's very simple with Performer 2.0 but I am not a beta tester and
I
> must do it now (so, with 1.2).
> Any idea ?
>
>-- End of excerpt from Lionel Maiaux

Lionel,

I'm a Performer novice, so excuse me if I'm wide of the mark ... but I think
that all you need to do is overload 'new' and 'delete'. I've used this in other
projects to allow new and delete to use home grown routines to give X-Process
objects / debug information.

Most good C++ references talk about how to do this (eg "C++ the Complete
Reference, 2nd Edition" by Osborne, ISBN 0-07-88212301, page 367).

void *operator new( size_t size
                    // , my_args Optional_Additional_Arguments
                  )
{
        // Peform home grown allocation
        // eg switch on additional args to do pfuNewXyz

        return (void *)pointer_to_memory

}

similarly for delete

void operator delete(void *p)
{
        // Perform home grown de-allocation

}

Simon

-- 
--------------------------------------------------------------------------------
Simon Hayhurst                                 Phone (41)-38-433733
Supercomputing Technology Centre               Fax   (41)-38-433905
Core Technology Group			       Voice Mail 5-7269
SGI, Cortaillod, Switzerland                   Internet simon ++at++ neu.sgi.com
--------------------------------------------------------------------------------

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:52 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.