Re: Allocating GeoSet stuff from shared

New Message Reply Date view Thread view Subject view Author view

Nicolas Gauvin (nicolas++at++cae.ca)
Tue, 23 Jul 1996 09:07:27 -0400


On Jul 22, 7:40pm, Scott McMillan wrote:
> Subject: Allocating GeoSet stuff from shared
>
> I have also tried using "new(pfGetSharedArena()) .." without luck (it won't
> compile).
>

If you look at the definition of a pfVec3 you will see that a macro
called PFSTRUCT_DECLARE is used to override the default new and delete
operators. This macro is defined in the file pfStruct.h and has the following
notice:

// CAUTION: since the allocation of storage for arrays of objects,
// e.g. "pfStruct *objs = new pfStruct[10]"; uses the global new
// operator, these will not be allocated from shared memory unless
// explicitly allocated and initialized, e.g. by using pfStruct::malloc()
// and explicitly invoking a constructor-like function for each
// array element.

This is related to a shortcoming of the C++ language described in example 14-2
of the programming guide:

"C++ does not provide a mechanism to delete arrrays of objects allocated with
a new operator defined to take additional arguments, eg operator new(size_t s,
void* arena). Attempting to delete an array of objects allocated in this manner
can cause fatal results."

So by stoping you from using it, Performer protects you from a pitfall of
the C++ language.

-- 
Nicolas Gauvin			CAE Electronics Ltd., 8585 Cote De Liesse
Software Developer 		Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications	tel: +1 514 341 2000 extension 2275
nicolas++at++cae.ca			fax: +1 514 340 5496
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++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:53:13 PDT

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