You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Marco Spinetti <m....@pisa.iol.it> on 2004/11/23 12:10:57 UTC

Shared memory

Hi all,
I have a question about shm.
I'm trying to write a library which is coomon to all my apache (1.3.x) 
modules.
This library at the apache startup, should put my complex  structered 
data in a shared memory segment and the all apache childs read this 
structure.
Well, I'm not expert of shared memory: so I have a question.
In my startup, I create my shared memory with:

rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, pool);

My structured data is composed by an array of structures and each member 
is composed by int, pointers of char and a pointer of xsltStylesheetPtr 
(libxslt....).
So I should allocate memory with malloc. But with shared memory can I 
should allocate memory with malloc or calloc?
I'm getting segmentation fault when I try to access my structured data 
members: for example

pp->bb[insert]->id = id_int;

Can I missing something?

Thanks for the help

--Marco