Re: [Rd] memory management in C code

From: Rui Barradas <ruipbarradas_at_sapo.pt>
Date: Fri, 07 Dec 2012 18:45:57 +0000

Hello,

This is explained in Writing R Extensions, Section 6.1 file R-exts.pdf in your distribution of R, folder doc.
There are two types of functions to allocate memory in C functions called from R code.

  1. R_alloc() - the memory is automatically reclaimed at the end of the function call.
  2. Calloc/Realloc - you must call Free() [ uppercase, not free() ] at the end of the function call.

Hope this helps,

Rui Barradas
Em 07-12-2012 12:40, Vineeth Mohan escreveu:
> Hi ,
>
> I am a newbie to R and i am trying to create a R package which is pretty
> main memory intensive.
> I would like to know what happens to the variables allocated in the C code
> while writing R extensions based on C.
> Are they preserved until someone de-allocate them or are they taken out by
> R's garbage collection ?
>
> Thanks
> Vineeth
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 07 Dec 2012 - 18:50:44 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 08 Dec 2012 - 01:23:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive