[R] heavy processing during R_init_XXXXX()

Alexandre Aguiar asaguiar at spsconsultoria.com
Mon Aug 8 02:09:23 CEST 2011


Hi.

Need some advice. I have to load a library during R_init_XXXXX() with 
dlopen(). The library file is 23 megabytes long and loads several other 
libraries. Everything happens during dlopen() execution, out of control, 
and takes around 1 second on first load in a quadcore. Besides, due to 
security reasons, a hash of the library file is going to be computed. 
Still do not know how long it will take.

Questions.

Is 1 second acceptable for R? Slower machines may take a lot longer to 
return from R_init_XXXXX(). Does R_init_XXXXX() have to return soon or 
call R_CheckUserInterrupt()? Or is it somehow free from this R need?

Is it safe to load the second library and compute the hash within other 
threads so R_init_XXXXX goes on? If some function of my extension library 
is called it can call R_CheckUserInterrupt() if and while the threads do  
not end. If such use of threads is safe inside R, is there a package that 
does it? Any tips?

Flags currently sent to dlopen are (RTLD_LAZY | RTLD_LOCAL). Revolving the 
R sources could not find the flags R uses. Does any of you know for sure 
the flags used to load extensions with loadLibrary()? Looking into 
computeDLOpenFlag() did not answer the question. Is there a recommended 
flags set in this situation?

Aparently dlopen() flags LM_ID_BASE and RTLD_GROUP (their use sounds wise) 
are not defined in Linux. Is this correct or I missed something?

Thanks.

-- 


Alexandre

--
Alexandre Santos Aguiar, MD, SCT
-------------- Pr?xima Parte ----------
Um anexo n?o-texto foi limpo...
Nome: n?o dispon?vel
Tipo: application/pgp-signature
Tamanho: 198 bytes
Descri??o: This is a digitally signed message part.
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110807/a63ce826/attachment.bin>


More information about the R-help mailing list