Mark Baranowski (baranowski++at++marklynn.demon.co.uk)
Thu, 04 Sep 1997 08:21:44 GMT
>Hi,
>
>I have notice that whatever commands which require the
>memory from shared memory; i.e.:
>
> pfMalloc(sizeof(DCSData), arena);
>
>they must always be prefaced by:
>
> arena = pfGetSharedArena();
You need to tell pfMalloc etc which arena to allocate from, but you
don't need to preface each pfMalloc call with pfGetSharedArena.
>
>In fact, as I understand, it is even possible to do this:
>
> pfMalloc(sizeof(DCSData), pfGetSharedArena());
Yes you can if you want.
>
>This, now, begs the question:
>
> What is the purpose of pfGetSharedArena();
>
>Meaning this:
>
> If it must always be called, what is the point of
>having it as an optional command? Why not imbed it inside the
>pfMalloc()? The fact that this is not done suggests, to me, that
>there must be another purpose for:
>
> arena = pfGetSharedArena();
>
>which has a use distinct from
>
> pfMalloc(sizeof(DCSData),arena);
>
>
>Could someone elaborate on this?
>
You could create your own arenas and pfMalloc from these instead of
using the default Performer arena. Hence the use of the second
parameter in pfMalloc etc. Note if arena is NULL, then the space is
allocated from the heap.
pfGetSharedArena returns the default shared memory arena created by
Performer when you exectute pfInit (another arena for locks and
semaphores is also created and can be returned with pfGetSemaArena).
The value returned by pfGetSharedArena will not change during the
execution of your program. So you can just get the arena pointer once
and use that in all subsequent calls to pfMalloc etc.
Regards,
Mark.
--
Mark Baranowski at work (baranowski++at++marklynn.demon.co.uk)
Pera, VR Division. Melton Mowbray, Leics. LE13 0PB. UK.
Tel: +44 (0)1664 501501, Fax: +44 (0)1664 501553
All opinions expressed are my own and should not be viewed
as representing my employer unless stated otherwise.
===================================List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:52 PDT