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 radf...@cs.toronto.edu 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

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 allocations. If

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 radf...@cs.toronto.edu 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

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 anticipating: add a

[Rd] Recycling memory with a small free list

2015-02-17 Thread Nathan Kurz
I'm trying to improve the performance of the update loop within a logistic regression, and am struggling against the overhead of memory allocation and garbage collection. The main issue I'd like to solve is with assignments inside of loops like this: reweight = function(iter, w, Q) { for (i