[Rd] memory allocation questions
Mark.Bravington at csiro.au
Mark.Bravington at csiro.au
Wed Sep 15 00:47:31 CEST 2004
Thanks both
All seems to work now, whether I use R_chk_alloc etc. (as per RS.h) or the Delphi routines. Sounds like I might as well stick with the latter though, since I have to do the housekeeping anyway.
Mark
#>should I bother using the R [memory allocation] routines instead [of the Delphi built-ins]?
#
#There is not much reason to need to use the R routines. The
#disadvantages of using Delphi allocation are:
#
# - Your allocations won't be automatically deleted by the garbage
#collector (but neither are those of Calloc, you need R_alloc for that)
# - If allocation fails, it will be up to you to detect that and deal
#with it.
#
#The disadvantage of using the R routines Calloc etc. is that
# - You need to translate C macros to Delphi.
# - You need to worry about whether the RS.h file has changed with
#each release (but the Calloc etc. macros are likely to be very stable,
#they haven't changed since 2000).
#
#Duncan Murdoch
#
#> if I do use the R replacements, what are their names nowadays?
#
#> R-EXTS refers to Calloc, Realloc and Free, but these aren't exported by
#> R.DLL (for R1.9.0 or 1.9.1) and I couldn't find mention of any name
#> change in the NEWS file.
#
#There is no change. R-exts does say you must include the appropriate
#headers, in this case include/R_ext/RS.h. They are defines, and not just
#simple calls to entry points. I'll leave you to take a closer look.
#
#--
#Brian D. Ripley, ripley at stats.ox.ac.uk
More information about the R-devel
mailing list