Re: [R-pkg-devel] Replacement for SETLENGTH

2025-01-15 Thread Ivan Krylov via R-package-devel
On Wed, 15 Jan 2025 15:30:36 + "Merlise Clyde, Ph.D." wrote: > For memory limited machines, the alloc/copy was a problem for memory > usage - and if I recall was one of the reasons in 2008 I switched to > SETLENGTH, which doesn't seem to do an allocation ??? If there is > going to be an abso

Re: [R-pkg-devel] Replacement for SETLENGTH

2025-01-15 Thread Iris Simmons
> > > Merlise Clyde (she/her/hers) > Professor of Statistical Science and Director of Graduate Studies > Duke University > > > From: Iris Simmons > Sent: Wednesday, January 15, 2025 1:00 AM > To: Merlise Clyde, Ph.D. > Cc: r-package-devel@

Re: [R-pkg-devel] Replacement for SETLENGTH

2025-01-15 Thread Merlise Clyde, Ph.D.
cal Science and Director of Graduate Studies Duke University From: Iris Simmons Sent: Wednesday, January 15, 2025 1:00 AM To: Merlise Clyde, Ph.D. Cc: r-package-devel@r-project.org Subject: Re: [R-pkg-devel] Replacement for SETLENGTH   Hi Merlise! Referring

Re: [R-pkg-devel] Replacement for SETLENGTH

2025-01-15 Thread Tomas Kalibera
On 1/15/25 05:26, Merlise Clyde, Ph.D. wrote: I am trying to determine the best way to eliminate the use of SETLENGTH to truncate over allocated vectors in my package BAS to eliminate the NOTES about non-API calls in anticipation of R 4.5.0. From WRE: "At times it can be useful to allocate

Re: [R-pkg-devel] Replacement for SETLENGTH

2025-01-14 Thread Iris Simmons
Hi Merlise! Referring to here: https://github.com/wch/r-source/blob/8ca367db0c94194f07ee7bcf4b883e9c5dc11e02/src/main/builtin.c#L832 It seems as though the object is only re-used if the new length is equal to the old length. If you use Rf_lengthgets, you will need to protect the return value.

[R-pkg-devel] Replacement for SETLENGTH

2025-01-14 Thread Merlise Clyde, Ph.D.
I am trying to determine the best way to eliminate the use of SETLENGTH to truncate over allocated vectors in my package BAS to eliminate the NOTES about non-API calls in anticipation of R 4.5.0. >From WRE: "At times it can be useful to allocate a larger initial result >vector and resize it to