Gary Hall (gary++at++rockyorl.orl.mcd.mot.com)
Tue, 8 Oct 1996 10:38:04 -0400
I have a question about pfDPoolAlloc(). I far as I can tell it allocates
memory only on a four byte boundary (except for the first call). This is
a problem if one is attempting to use the memory allocated to reference
data type that must be on say a 8 byte boundary (like doubles). The man
page says that the size of the memory will be rounded up to a 16 byte multiple,
but says nothing about the address it returns. The pfMalloc() routines seem
to always return addresses on a 8 byte boundary, but this is not the case for
pfDPoolAlloc(). The result is the same under version 2.0 or 2.1 of Performer.
Here is example code fragment of what I am doing:
pfDataPool *data_pool;
int size = 100000;
void *mem=NULL, *mem2=NULL;
/* Get memory for data shared between processes */
if ( !(data_pool=pfAttachDPool("DataPool")) )
{
data_pool = pfCreateDPool(size, "DataPool");
}
if ( !(mem=(void *) pfDPoolFind(data_pool, 1)) )
{
mem= (void *) pfDPoolAlloc(data_pool, size, 1);
bzero( mem, size ); /* clear if new */
}
mem2 = (void *) pfDPoolAlloc(data_pool, size, 10);
/* mem2 will not always be on a 8 byte boundary */
Unless I am missing something here, I think this is a bug!
Thanks,
Gary
-- *************************************** * FROM: Gary Hall * * EMAIL: gary++at++orl.mcd.mot.com * * Motorola - SSTG * * 12424 Research Pkwy, Suite 217 * * Orlando, FL 32826 * * Phone: (407)823-7017 * * Fax: (407)823-7010 * ***************************************======================================================================= 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:53:43 PDT