Re: pfDataPool::alloc of pf types

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++sgi.com)
Thu, 15 Jul 1999 10:19:53 -0700


ross::barna wrote:
>
> I am having problems allocating and using memory (with performer
> structures) in the pfDataPool. I can use simple types (int, float...) but
> i get seg faults and bus errors when attempting to allocate space and new
> a pfScene.
>
> here is what i tried:
>
> //.....
>
> scene = (pfScene*)pool->alloc(sizeof(pfScene), SCENE_ID); //works
> *scene = *(new Scene()) // this is wrong... i dont' know what to do?!?
>
> //.....
>
> can someone throw me a bone here?
>

You want to new a pfScene not Scene. You really need to use new so your
constructor get's called and it's created in the right arena etc. At the
very least this is wastefull and has the potential to leak memory.

It took me a while to figure out what you were trying to do here, I
thought it was either/or choice but it seems you are trying a copy but I
can't see why you need to, just do this:

scene = new pfScene;

Cheers,Angus.

-- 

For advanced 3D graphics Performer + OpenGL based examples and tutors: http://www.dorbie.com/


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Thu Jul 15 1999 - 10:19:56 PDT

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