Re: [Rd] Recycling memory with a small free list

2015-02-19 Thread Karl Millar via R-devel
If you link to tcmalloc instead of the default malloc on your system, the performance of large allocations should improve. On unix machines you don't even need to recompile -- you can do this with LD_PRELOAD. The downside is that you'll almost certainly end up with higher average memory usage.as

Re: [Rd] Recycling memory with a small free list

2015-02-19 Thread luke-tierney
On Wed, 18 Feb 2015, Nathan Kurz wrote: On Wed, Feb 18, 2015 at 7:19 AM, Radford Neal wrote: ... with assignments inside of loops like this: reweight = function(iter, w, Q) { for (i in 1:iter) { wT = w * Q } } ... before the RHS is executed, the LHS allocation would be added to a smal

Re: [Rd] Recycling memory with a small free list

2015-02-18 Thread Radford Neal
Radford Neal: > > there's a danger of getting carried away and essentially rewriting > > malloc. To avoid this, one might try just calling "free" on the > > no-longer-needed object, letting "malloc" then figure out when it can > > be re-used. Nathan Kurz: > Yes, I think that's what I was anticipa

Re: [Rd] Recycling memory with a small free list

2015-02-18 Thread Nathan Kurz
On Wed, Feb 18, 2015 at 7:19 AM, Radford Neal wrote: >> ... with assignments inside of loops like this: >> >> reweight = function(iter, w, Q) { >> for (i in 1:iter) { >> wT = w * Q >> } >> } >> ... before the RHS is executed, the LHS allocation would be added >> to a small fixed length lis

Re: [Rd] Recycling memory with a small free list

2015-02-18 Thread Radford Neal
> ... with assignments inside of loops like this: > > reweight = function(iter, w, Q) { > for (i in 1:iter) { > wT = w * Q > } > } > ... before the RHS is executed, the LHS allocation would be added > to a small fixed length list of available space which is checked > before future allocati