Re: Allocating GeoSet stuff from shared

New Message Reply Date view Thread view Subject view Author view

Veraart (rioj7++at++fel.tno.nl)
Tue, 23 Jul 1996 10:04:24 +0200 (MET DST)


> pfVec3 *vertex;
> if (NULL == (force_vertex = new pfVec3[2]))
> {
> cerr << "Unable to pfMalloc vertex list array.\n";
> exit(3);
> }
>
> remind me of shared arena problems -- like the pfVec3 array and its elements
> aren't in the shared arena (or little Onyx-gremlins are romping through
> memory).
>
> I have also tried using "new(pfGetSharedArena()) .." without luck (it won't
> compile).
>
> I have had success by dropping back to 1.2 habits and using pfMalloc:
>
> if (NULL == (force_vertex = (pfVec3 *) pfMalloc(2*sizeof(pfVec3),
> pfGetSharedArena())))
> {
> ...
> }
>
> but I would really like to know the proper way to do this using new.

I haven't tried but is the explicit placement with the new operator working.
It's just a combine of both code samples.

   pfVec3 *vertex;
   char *buffer;
   buffer = pfMalloc(2*sizeof(pfVec3),pfGetSharedArena());
   if (buffer != (force_vertex = new (buffer) pfVec3[2]))
   {
      cerr << "Unable to pfMalloc vertex list array.\n";
      exit(3);
   }
For pfVec3 objects you don't get much benifit from this but if the objects
need the constructor than this is the method according to my C++ book.

Mario
=======================================================================
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:12 PDT

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