Re: C++ new/delete operator with shared arena in 2.0

New Message Reply Date view Thread view Subject view Author view

Jim Helman (jimh++at++surreal)
Wed, 20 Dec 95 19:13:14 -0800


I'd expect most user subclasses to be derived from pfObject.
Those classes would be using pfObject::new().

For a subclass foo of pfObject:

        new(arena) foo; == allocate foo from arena
        new foo; == allocate foo from pfGetSharedArena()

As for pfMemory::new():

        new(nbytes, arena) pfMemory; == pfGetMemory(pfMalloc(nbytes, arena));
        new(nbytes) pfMemory; == pfGetMemory(pfMalloc(nbytes, pfGetSharedArena()));
        new pfMemory; == bogus, no malloc size provided

Note the first argument in the declaration in the header files,
"size_t s," is created implicitly by C++ from the size of the object
and is not visible to the C++ application.

rgds,

-jim helman

jimh++at++surreal.asd.sgi.com
415/933-1151


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:52:10 PDT

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