Re: [info-performer] Request

New Message Reply Date view Thread view Subject view Author view

From: Tom Jolley (jolley++at++fltsim.stl.mo.boeing.com)
Date: 04/19/2002 12:20:52


Hi Allan,

The excerpt from ch 22 doesn't support your recommendation of using
delete over pfDelete. pfDCS is derived from pfObject and so it should
be destroyed using pfDelete according to the excerpt. Just to see what
would happen if delete is used over pfDelete I tried it and got a core
file.

Allan Schaffer wrote:
>
> Hello Angel,
>
> Ángel García wrote:
> > We have made an application with OpenGL Performer on a Linux RedHat 7.2 Kernel 2.4.7-10, dual processor.
> > We call:
> >
> > pfSharedArenaSize(256000000);
> > pfInitArenas();
> > pfInit();
> > pfuInitUtil();
> > pfiInit();
> > arena=pfGetSharedArena();
> >
> > at the begin of the program.
> >
> > We create objects with:
> > dcsbag = new pfDCS;
> > and we destroy them with:
> > pfDelete(dcsbag);
> >
> > We take the next error:
> >
> > PF Fatal Resource: pfMemory::new() Unable to allocate enough memory
>
> It's a little unusual to have both pfInitArenas() and pfInit() in the
> initialization segment but this probably isn't the problem. The thing
> to change is to use the 'delete' operator instead of pfDelete.
>
> Here's an excerpt from the Performer programming guide (ch 22) which
> explains a bit more about when to use the delete operator, and when to
> use pfDelete:
>
> Creating and Deleting OpenGL Performer Objects
>
> The OpenGL Performer base classes all provide operator new and operator
> delete. All libpr and libpf objects, except pfObject, pfMemory, and
> their derivatives, must be explicitly created with operator new and
> deleted with operator delete. Objects of these classes cannot be created
> statically on the stack or in arrays.
>
> All objects of classes derived from pfObject or pfMemory are reference
> counted and must be deleted using pfDelete(), rather than the delete
> operator. pfDelete() checks the reference count of the object and, when
> multiprocessing, delays the actual deletion until other processes are
> done with the object. To decrement the reference count and delete with a
> single call use pfUnrefDelete().
> Note: Public structs such as pfVec3, pfSphere, etc. may be deleted
> either with pfDelete() or the delete operator.
>
> The default new operator creates objects in the current shared memory
> arena if one exists. libpr objects and public structures have an
> additional new operator that takes an arena argument. This new operator
> allows allocation from the heap (indicated by an arena of NULL) or from
> a shared memory arena created by the application with acreate().
>
> --
> Allan Schaffer allan++at++sgi.com
> Engr. Manager, Core Rendering 1-650-933-2160
> Silicon Graphics http://www.sgi.com

-- 
Tom Jolley
jolley++at++fltsim.stl.mo.boeing.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Apr 19 2002 - 12:21:29 PDT

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