From notulei at yahoo.com  Tue Apr 13 16:35:01 2004
From: notulei at yahoo.com (Alex Nu)
Date: Tue Apr 13 16:35:07 2004
Subject: [Rd] shared mem advice
Message-ID: <20040413143501.48691.qmail@web60106.mail.yahoo.com>


 Hi,

 I want to write a package where I would use
 shared memory for some vectors
 
 Any suggestion is appreciated...

 I wonder if the right approach would be to 
 modify add a modified version of the 

 allocVector(SEXPTYPE type, int length) function

 specifically

 shared_mem_id = shmget(shared_mem_key,
                        SHM_SIZE,                   
                        IPC_CREAT);

 shared = (SEXP) shmat(shared_mem_id, (void *)0, 0);


 my_allocVector(SEXPTYPE type, int length, SEXP 
                shared) {
  
 SEXP s=shared;
 ....

 And erase this if:

#################################################
 if(size >= 
    (LONG_MAX / sizeof(VECREC))-sizeof(SEXPREC_ALIGN)
     ||
    (s = 
    malloc(sizeof(SEXPREC_ALIGN) + size *
           sizeof(VECREC))
   )
    == NULL) { {
#################################################

 Alex


[Rd] shared mem advice
Alex Nu