Re: [Rd] strange increase in the reference number

2019-07-15 Thread King Jiefei
Hi Duncan, Gabriel, and Brodie Thanks for the explanations and references. Brodie's blog talks about exactly the same problem without involving too many technical details. I would recommend to read it if anyone is interested in it. I really appreciate all of you guys' answers. Best, Jiefei On S

Re: [Rd] strange increase in the reference number

2019-07-13 Thread brodie gaslam via R-devel
Re ENSURE_NAMEDMAX, I am unsure but think this happens in (src/eval.c@492): static SEXP forcePromise(SEXP e) {     if (PRVALUE(e) == R_UnboundValue) {     /* ... SNIP ...*/     val = eval(PRCODE(e), PRENV(e));     /* ... SNIP ...*/     SET_PRSEEN(e, 0);     SET_PRVALUE(e, val);     ENSURE_NAMEDMAX

Re: [Rd] strange increase in the reference number

2019-07-13 Thread brodie gaslam via R-devel
If you would like more details I wrote about this recently: https://www.brodieg.com/2019/02/18/an-unofficial-reference-for-internal-inspect/ Basically as soon as you hit a closure R assumes that theargument might still have a surviving reference to iteven after the closure evaluation ends because

Re: [Rd] strange increase in the reference number

2019-07-12 Thread Gabriel Becker
Hi Jiefei and Duncan, I suspect what is likely happening is that one of ENSURE_NAMEDMAX or MARK_NOT_MUTABLE are being hit for x. These used to set named to 3, but now set it to 7 (ie the previous and current NAMEDMAX value, respectively). Because these are macros rather than C functions, its no

Re: [Rd] strange increase in the reference number

2019-07-12 Thread Duncan Murdoch
On 12/07/2019 1:22 p.m., King Jiefei wrote: Hi, I just found a strange increase in the reference number and I'm wondering if there is any reason for it, here is the code. a=c(1,2,3) .Internal(inspect(a)) @0x1bf0b9b0 14 REALSXP g0c3 [NAM(1)] (len=3, tl=0) 1,2,3 is.vector(a) [1] TRUE